N
NathetJoel
Hi!
I have a problem using the input file, what I want to do is either send the
file with an attachment or upload it on the server. When I do my test on my
PC everything is OK but when I put it on the server everything fail. We open
permission, we did a lot of things but it still doesn't do it. We don't have
errors. Is anyone have a solution?
Thanks Joel
Here the code with the filesaveas;
Dim strFilename As String
Try
' Get the file name.
strFilename = filUpload.PostedFile.FileName
If filUpload.PostedFile.ContentLength = 0 Then
Else
' Get the base name for the file (exclude path).
strFilename = System.IO.Path.GetFileName(strFilename)
' Save uploaded file to server.
filUpload.PostedFile.SaveAs("\\www.ubishops.ca\uploadfiles\" & strFilename)
'I ALSO TRIED IT WITH THIS Server.MapPath("./uploadfiles") & "/"
End If
Catch ex As System.UnauthorizedAccessException
Me.TextBox1.Text = "You must set the permissions on the server to allow the
ASPNET user to write to the destination folder."
Catch ex As Exception
Me.TextBox1.Text = "An unexpected error occurred: " & ex.Message
Finally
End Try
'MAIL ATTACHMENT CODE
Dim msg As New MailMessage
With msg
..From = Me.mmlblClient.Text + "@server"
..To = "MAIL@MAIL"
..Subject = "HelpDesk Service Request"
If filUpload.PostedFile.ContentLength = 0 Then
Else
'dim atcItem As New MailAttachment(Request.MapPath("./uploadfiles") '& _
'"\" & strFilename)
Dim atcItem As New MailAttachment(strFilename)
..Attachments.Add(atcItem)
End If
..Body = "ITS PrintShop Request#"
'Me.txtDescription.Text
End With
'msg.Attachments.Add(llist)
SmtpMail.SmtpServer = "SERVER"
SmtpMail.Send(msg)
I have a problem using the input file, what I want to do is either send the
file with an attachment or upload it on the server. When I do my test on my
PC everything is OK but when I put it on the server everything fail. We open
permission, we did a lot of things but it still doesn't do it. We don't have
errors. Is anyone have a solution?
Thanks Joel
Here the code with the filesaveas;
Dim strFilename As String
Try
' Get the file name.
strFilename = filUpload.PostedFile.FileName
If filUpload.PostedFile.ContentLength = 0 Then
Else
' Get the base name for the file (exclude path).
strFilename = System.IO.Path.GetFileName(strFilename)
' Save uploaded file to server.
filUpload.PostedFile.SaveAs("\\www.ubishops.ca\uploadfiles\" & strFilename)
'I ALSO TRIED IT WITH THIS Server.MapPath("./uploadfiles") & "/"
End If
Catch ex As System.UnauthorizedAccessException
Me.TextBox1.Text = "You must set the permissions on the server to allow the
ASPNET user to write to the destination folder."
Catch ex As Exception
Me.TextBox1.Text = "An unexpected error occurred: " & ex.Message
Finally
End Try
'MAIL ATTACHMENT CODE
Dim msg As New MailMessage
With msg
..From = Me.mmlblClient.Text + "@server"
..To = "MAIL@MAIL"
..Subject = "HelpDesk Service Request"
If filUpload.PostedFile.ContentLength = 0 Then
Else
'dim atcItem As New MailAttachment(Request.MapPath("./uploadfiles") '& _
'"\" & strFilename)
Dim atcItem As New MailAttachment(strFilename)
..Attachments.Add(atcItem)
End If
..Body = "ITS PrintShop Request#"
'Me.txtDescription.Text
End With
'msg.Attachments.Add(llist)
SmtpMail.SmtpServer = "SERVER"
SmtpMail.Send(msg)