public static string fileUpladPost(string spath)
    {
        HttpFileCollection files = HttpContext.Current.Request.Files;

        StringBuilder strMsg = new StringBuilder();

        for (int i = 0; i < files.Count; i++)
        {
            HttpPostedFile f = files[i];

            string fileName = Path.GetFileName(f.FileName);

            if (fileName != String.Empty)
            {
                string fileExtension = Path.GetExtension(fileName);
                strMsg.Append("上传的文件类型:" + f.ContentType.ToString() + "<br>");
                strMsg.Append("客户端文件地址:" + f.FileName + "<br>");
                strMsg.Append("上传文件的文件名:" + fileName + "<br>");
                strMsg.Append("上传文件的扩展名:" + fileExtension + "<br><hr>");

                f.SaveAs(HttpContext.Current.Server.MapPath(spath) + fileName);
            }
        }

        return strMsg.ToString();
    }
//该函数可以处理POST过来的FILE,spath为存储路径

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-25
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-01
  • 2021-08-01
  • 2021-05-30
  • 2021-06-17
相关资源
相似解决方案