B
BlackBox
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
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