<%@ Page Language="VB" %> <script runat="server"> Sub btnUpload_OnClick(sender As Object, e As EventArgs) Dim myUpoad As HttpPostedFile = Request.Files("myFile1") If myUpoad.FileName <> "" Then Dim strFileName = System.IO.Path.GetFileName(myUpoad.FileName) myUpoad.SaveAs(Server.MapPath("Myfiles/" & strFileName)) Me.lblText.Text = strFileName & " Uploaded.<br>" End If 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="myFile1" 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 ของทีมงานไทยครีเอท