Upload script not working on server but fine locally
Code:
If FileUpload1.HasFile Then
Dim filepath As String = FileUpload1.PostedFile.FileName
Dim pat As String = "\\(?:.+)\\(.+)\.(.+)"
Dim r As Regex = New Regex(pat)
'run
Dim m As Match = r.Match(filepath)
Dim file_ext As String = m.Groups(2).Captures(0).ToString()
Dim filename As String = m.Groups(1).Captures(0).ToString()
Dim file As String = filename & "." & file_ext
'save the file to the server
FileUpload1.PostedFile.SaveAs(Server.MapPath("../images/") & file)
lblMsg.Text = "File Uploaded!"
End If
Works a charm locally but as soon as i upload this to the live server (hosted by heart internet) i get:
Code:
Server Error in '/' Application.
Specified argument was out of the range of valid values.
Parameter name: i
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: i
Any advise???
Re: Upload script not working on server but fine locally
Are you sure that the permission settings on your server allow you to upload files there?
Re: Upload script not working on server but fine locally
Hello,
Is it possible for you to do some remote debugging on this server? Or how about adding some logging to your application?
If would be good to know exactly what line it is failing on, and the associated values of each of the variables in use.
Gary