日期:2014-05-18 浏览次数:21148 次
protected void btnSubmit_Click(object sender, EventArgs e)
{
lblOldAddress.Text += "<br />"; //换行
lblNewAddress.Text += "<br />";
HttpFileCollection hfc = Request.Files;
for (int i = 0; i < hfc.Count; i++)
{
HttpPostedFile hpf = hfc[i];
if (hpf.ContentLength > 0)
{
string oldAddress = hpf.FileName;
string newAddress = Server.MapPath("file\\") + System.IO.Path.GetFileName(oldAddress);
hpf.SaveAs(newAddress);
}
}
}
------解决方案--------------------
B/S 的?最好去网上搜索NEATUPLOAD这个组件,有源码,附带JS的源码也有,上传文件,也可以上传大文件,还带进度条,这个组件的实例看懂了可以学习很多知识。
http://www.pudn.com/downloads161/sourcecode/windows/dotnet/detail732798.html