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为存储路径