<%@ Page Language="VB" %> <%@ Import Namespace = "System.Web.HttpFileCollection" %> <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 (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 Next End Sub </script> <html> <head> <title>ThaiCreate.Com ASP.NET - Upload files</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>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท