欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【在ASP.NET中实现多文件上传】,下面是详细的分享!
在ASP.NET中实现多文件上传
privateBooleanSaveFiles()
{
//得到File表单元素
HttpFileCollectionfiles=HttpContext.Current.Request.Files;
try
{
for(intintCount=0;intCount<files.Count;intCount++)
{
HttpPostedFilepostedFile=files[intCount];
stringfileName,fileExtension;
//获得文件名字
fileName=System.IO.Path.GetFileName(postedFile.FileName);
if(fileName!="")
{
//获得文件名扩展
fileExtension=System.IO.Path.GetExtension(fileName);
//可根据不同的扩展名字,保存文件到不同的文件夹
//注意:可能要修改你的文件夹的匿名写入权限。
postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath("upFiles/")+fileName);
}
}
returntrue;
}
catch(System.ExceptionEx)
{
returnfalse;
}
}
以上所分享的是关于在ASP.NET中实现多文件上传,下面是编辑为你推荐的有价值的用户互动:
相关问题:请问在asp.net中如何实现多文件上传
答:这要看你具体使用哪种组件…… 或者只是单纯多个FileUpload,那么你要加入循环。 >>详细
相关问题:在ASP.NET web项目中怎样才能实现多文件上传 fileu...
答:建议用jquery的Uploadify上传插件,无刷新+进度条+多文件上传。 >>详细
相关问题:ASP.NET中怎么实现多文件同时上传?要求点浏览的时...
答:upload.aspx 多文件上传 function addfile() { var str = document.getelementbyid(myfile).insertadjacenthtml("beforeend",str) } 多文件上传 upload.aspx.cs using system; using system.collections; using system.componentmodel; using sy... >>详细
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
