Inherits System.Web.UI.Page
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
If Not fileUpEx.HasFile Is Nothing Then
Dim filepath As String = fileUpEx.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
fileUpEx.PostedFile.SaveAs(Server.MapPath(".\") & file)
lblStatus.Text = "File Saved to: " & Server.MapPath(".\") & file
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
End Class