文件上传

<Script language="VB" runat="Server">Sub Page_Load(Sender As Object,e As EventArgs)   cur_dir.text=Request("dir")   File_dir.text=Request("dir")& "/" End SubSub UploadFile(sender as object,e as eventargs)   '如果文件上传的长度为0,则说明文件上传失败   If FileUp.postedFile.ContentLength=0 then      Response.Write("上传文件失败!")   Else     '存储上传文件     Dim Filename as string=File_dir.text & fname.text     Fileup.postedFile.Saveas(filename)     Response.Redirect("NetIdle.aspx?dir=" & cur_dir.text)   End IfEnd sub</script><html><Body><H3>上传单个文件!<H3>当前目录:<asp:Label id="cur_dir" BorderStyle="Groove" runat="server"/><br><p><Form id="Form1" Enctype="multipart/form-data" runat="Server" method="Post">文件路径:<asp:Label id="File_dir" runat="Server"/><asp:TextBox id="fname" runat="Server"/>请选择上传文件:<input type="File" id="fileup" runat="Server"><p><Asp:button id="Upload" OnClick="UploadFile" text="Upload" runat="Server"/></Form></body></html>

相关文章
相关标签/搜索