"BlackBox" wrote:
> If Not (oFile.PostedFile Is Nothing) Then 'Check to make sure we
> actually have a file to upload
>
> Dim strLongFilePath As String = oFile.PostedFile.FileName
> Dim intFileNameLength As Integer = InStr(1,
> StrReverse(strLongFilePath), "\")
> Dim strFileName As String = Mid(strLongFilePath,
> (Len(strLongFilePath) - intFileNameLength) + 2)
>
> Dim uploadpath As String = Server.MapPath("~\docs\")
>
> Select Case oFile.PostedFile.ContentType
> Case "application/msword", "application/pdf" 'Make sure we
> are getting a valid JPG image
> oFile.PostedFile.SaveAs(uploadpath & strFileName)
> txtlocation.Text = "docs\" & strFileName
> lblresult.Text = strFileName & " uploaded successfully."
> AddData()
>
> Case Else
> lblresult.Text = "Not a valid .doc or pdf file. Please
> try again."
>
> End Select
> End If
> =============================================
> Getting "Could not find a part of the path". I have checked the permissions
> and it is working locally but not on the Server.
> Any help would be great.
>
> Thanks
>
My guess would be that those InStr, StrReverse, Mid functions are messing
you up. Look at the example on MSDN
(
http://msdn.microsoft.com/en-us/libr...8VS.80%29.aspx).
You should also confirm the path you are getting out at the line
oFile.PostedFile.SaveAs(uploadpath & strFileName) is actually a well formated
path to a file. You did not indicate that is the location of the error, but
it makes the most sense.
Mike