ASP源码.NET源码PHP源码JSP源码JAVA源码DELPHI源码PB源码VC源码VB源码Android源码

在ASP.NET中如何实现多文件上传

来源:网络整理     时间:2014-11-10     关键词:

本篇文章主要介绍了"在ASP.NET中如何实现多文件上传",对于.NETjrs看球网直播吧_低调看直播体育app软件下载_低调看体育直播感兴趣的同学可以参考一下:

  PRivate Boolean SaveFiles()
  {
   //得到File表单元素
   HttpFileCollection files = HttpContext.Current.Request.Files;
   try
   {
    for(int intCount= 0; intCount< files.Count; intCount++)
    {
   
     HttpPostedFile postedFile = files[intCount];
     string fileName, 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);
     }
    }
    return true;
   }
   catch(System.Exception Ex)
   {
    return false;
   }
  }

以上就介绍了在ASP.NET中如何实现多文件上传,包括了方面的内容,希望对.NETjrs看球网直播吧_低调看直播体育app软件下载_低调看体育直播有兴趣的朋友有所帮助。

本文网址链接:http://www.codes51.com/article/detail_32415.html

相关图片

相关文章