ASP.NET(vb.net) & Upload file (HTMLInputFile - Multiple Upload) Part. 2 - The in this tutorial, you’ll learn and example scripts how to Upload file (HTMLInputFile multiple upload part 2) using by ASP.NET scripts.
ShotDev Focus:
- ASP.NET(vb.net) & Upload file (HTMLInputFile - Multiple Upload) Part. 2
Example
AspNetMultiHTMLInputFile2.aspx
<%@ Import Namespace = "System.Web.HttpFileCollection" %> <%@ Page Language="VB" %> <script runat="server"> Sub btnUpload_OnClick(sender As Object, e As EventArgs) Dim i As Integer Dim myUpoad As HttpFileCollection = Request.Files Dim myFiles As HttpPostedFile Me.lblText.Text = "" For i = 0 To myUpoad.Count - 1 myFiles = myUpoad(i) IF myUpoad.Keys(i).ToString = "myFile" Then If (myFiles.FileName) <> "" Then Dim strFileName = System.IO.Path.GetFileName(myFiles.FileName) myFiles.SaveAs(Server.MapPath("Myfiles/" & strFileName)) Me.lblText.Text = Me.lblText.Text & strFileName & " Uploaded.<br>" End If End IF Next End Sub </script> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form id="form1" runat="server" enctype="multipart/form-data"> <input name="myFile" type="file"><br /> <input name="myFile" type="file"><br /> <input name="myFile" type="file"><br /> <input name="myFile" type="file"><br /> <input name="myFile" type="file"><br /> <input name="myUpload" type="file"><br /> <input name="myUpload" type="file"><br /> <input name="myUpload" type="file"><br /> <input name="myUpload" type="file"><br /> <input name="myUpload" type="file"> <input id="btnUpload" type="button" OnServerClick="btnUpload_OnClick" value="Upload" runat="server" /> <hr /> <asp:Label id="lblText" runat="server"></asp:Label> </form> </body> </html>
Screenshot