to validate the path where the file will get uploaded..
Dim ext As String = System.IO.Path.GetExtension(Filedoc.PostedFile.FileName)
this is the file uploaded control
but i want to validate the path :
Server.MapPath("../Error/Feedbackdoc/" & ext)
using regular expression
If Filedoc.HasFile Then
Dim ImageFileExtRegEx As Regex = New Regex("(([.\.\])(\\([a-zA-Z]))$")
'Dim FilePathRegEx As Regex = New Regex("(?:[.\.\]/)([a-zA-Z]+)+([a-zA-Z]+)+(.jpeg|.jpg|.png|.doc|.docx|.pdf|.gif)$")
'Dim FilePathRegEx2 As Regex = New Regex("(?:[.\.\])\\(?:[a-zA-Z])*+(.jpeg|.jpg|.png|.doc|.docx|.pdf|.gif)$")
If ImageFileExtRegEx.IsMatch(Server.MapPath("../Error/Feedbackdoc/" & fid & ext)) Then
Filedoc.SaveAs(Server.MapPath("../Error/Feedbackdoc/" & fid & ext))
Else
objcommon.infoBox("Upload a valid file with extensions doc/docx/jpg/jpeg/pdf")
Exit Sub
End If
End If