ASP.NET(vb.net) & Upload file (HTMLInputFile - HTMLControl and runat=”server”) - The in this tutorial, you’ll learn and example scripts how to Upload file (HTMLInputFile and runat=”server”) using by ASP.NET scripts.
ShotDev Focus:
- ASP.NET(vb.net) & Upload file (HTMLInputFile - HTMLControl and runat=”server”)
Example
AspNetHTMLInputFileServer.aspx
<%@ Page Language="VB" %> <script runat="server"> Sub btnUpload_OnClick(sender As Object, e As EventArgs) If Not IsNothing(myFile1.PostedFile) Then Dim strFileName = System.IO.Path.GetFileName(myFile1.Value) Me.lblText1.Text = strFileName & " Uploaded." myFile1.PostedFile.SaveAs(Server.MapPath("Myfiles/"&strFileName)) End If End Sub </script> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form id="form1" runat="server"> <input id="myFile1" type="file" runat="server"> <input id="btnUpload" type="button" OnServerClick="btnUpload_OnClick" value="Upload" runat="server" /> <hr /> <asp:Label id="lblText1" runat="server"></asp:Label> </form> </body> </html>
Screenshot