找传奇、传世资源到传世资源站!

多文件上传并显示上传进度

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

多文件上传并显示上传进度 C#语言基础-第1张<%@ Page Language="C#" Debug="true"%><%@ Register TagPrefix="fup" Namespace="OboutInc.FileUpload" Assembly="FileUpload" %><%@ Import Namespace="System.IO" %><html xmlns="http://www.w3.org/1999/xhtml"><head><title>ASP.NET FileUploadProgress</title><script runat="server" language="c#"> void Page_load(object sender, EventArgs e) { if(Page.IsPostBack) { OboutFileCollection files = uploadProgress.Files; uploadedFiles.Text = ""; for(int i=0; i < files.Count; i ) { OboutPostedFile file = files[i]; file.SaveAs(MapPath("~/Uploaded/" Path.GetFileName(file.FileName))); if(uploadedFiles.Text.Length == 0) uploadedFiles.Text = "<b>成功上传文件:</b><table border=0 cellspacing=0>"; uploadedFiles.Text = "<tr>"; uploadedFiles.Text = "<td class='option2'>" Path.GetFileName(file.FileName) "</td>"; uploadedFiles.Text = "<td style='font:11px Verdana;'>&nbsp;&nbsp;" file.ContentLength .ToString() " bytes</td>"; uploadedFiles.Text = "<td class='option2'>&nbsp;&nbsp;(" file.ContentType ")</td>"; uploadedFiles.Text = "<td style='font:11px Verdana;'>&nbsp;&nbsp;<b>Input name</b>: \"" file.InputName "\"</td>"; uploadedFiles.Text = "</tr>"; } if(uploadedFiles.Text.Length==0) uploadedFiles.Text = "no files"; else uploadedFiles.Text = "</table>"; } }</script><script type="text/JavaScript">function Clear(){ document.getElementById("<%= uploadedFiles.ClientID %>").innerHTML = "";}function Cancel(){ <%= uploadProgress.ClientID %>_obj.CancelRequest();}function ServerException(mess){ alert(mess);}</script></head><body><br /><br /><form runat="server" id="form1"> <input type="file" name="myFile1" /><br/> <input type="file" name="myFile2" /><br/> <input type="file" name="myFile3" /><br/> <ASP:LinkButton runat="server" text="上传" /> &nbsp;&nbsp;&nbsp; <ASP:LinkButton runat="server" text="取消" onClientClick="Cancel(); return false;" /><br/> <br/> <fup:FileUploadProgress OnClientProgressStopped = "function(){alert('文件已上传');}" OnClientProgressStarted = "Clear" OnClientServerException = "ServerException" ShowUploadedFiles = "true" runat = "server" ID = "uploadProgress" InnerFiles = "true" StyleFile = "fup_styles/myStyle.css" LocalizationFile="fup_localization/en.xml" /> <fup:StatusPanel runat="server"> <asp:Label runat="server" id="uploadedFiles" Text="" /> </fup:StatusPanel> <br /></form></body></html>

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复