Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Input File
Message
From
16/05/2005 13:31:07
Joel Casse
Bishops University
Lennoxville, Quebec, Canada
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Using Input File
Environment versions
Environment:
ASP.NET
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01014623
Message ID:
01014623
Views:
68
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)
Reply
Map
View

Click here to load this message in the networking platform