zoukankan      html  css  js  c++  java
  • ASP.NET中实现多文件上传(普通)

    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;
       }
    }
  • 相关阅读:
    053(四十四)
    053(四十三)
    053(四十二)
    053(四十一)
    053(四十)
    053(三十九)
    053(三十八)
    053(三十七)
    053(三十六)
    【leetcode❤python】231. Power of Two
  • 原文地址:https://www.cnblogs.com/xinzhuangzi/p/4100716.html
Copyright © 2011-2022 走看看