<asp:FileUpload AccessKey="string" BackColor="color name|#dddddd" BorderColor="color name|#dddddd" BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge| Inset|Outset" BorderWidth="size" CssClass="string" Enabled="True|False" EnableTheming="True|False" EnableViewState="True|False" Font-Bold="True|False" Font-Italic="True|False" Font-Names="string" Font-Overline="True|False" Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium| Large|X-Large|XX-Large" Font-Strikeout="True|False" Font-Underline="True|False" ForeColor="color name|#dddddd" Height="size" ID="string" OnDataBinding="DataBinding event handler" OnDisposed="Disposed event handler" OnInit="Init event handler" OnLoad="Load event handler" OnPreRender="PreRender event handler" OnUnload="Unload event handler" runat="server" SkinID="string" Style="string" TabIndex="integer" ToolTip="string" Visible="True|False" Width="size" > </asp:FileUpload>
<%@ Page Language="C#" Debug="true" %> <script runat="server"> void btnSubmit_Click(object sender, EventArgs e) { if(this.fiUpload.HasFile) { this.fiUpload.SaveAs(Server.MapPath("Myfiles/" + fiUpload.FileName)); this.lblText1.Text = "File Name: " + fiUpload.PostedFile.FileName; this.lblText2.Text = "File Size: " + fiUpload.PostedFile.ContentLength; this.lblText3.Text = "File Type: " + fiUpload.PostedFile.ContentType; } } </script> <html> <head> </head> <body> <form runat="server"> <asp:FileUpload id="fiUpload" runat="server"></asp:FileUpload> <asp:Button id="btnSubmit" onclick="btnSubmit_Click" runat="server" Text="Submit"></asp:Button> <hr /> <asp:Label id="lblText1" runat="server"></asp:Label> <br> <asp:Label id="lblText2" runat="server"></asp:Label> <br> <asp:Label id="lblText3" runat="server"></asp:Label> </form> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท