基本信息
源码名称:多文件上传并显示上传进度
源码大小:0.07M
文件格式:.rar
开发语言:C#
更新时间:2015-06-18
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
<%@ 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;'> " file.ContentLength .ToString() " bytes</td>";
uploadedFiles.Text = "<td class='option2'> (" file.ContentType ")</td>";
uploadedFiles.Text = "<td style='font:11px Verdana;'> <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="上传" />
<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>