HttpFileCollection files = HttpContext.Current.Request.Files;
HttpPostedFile postedFile = files[0];
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("images/") + fileName);
}
HttpPostedFile postedFile = files[0];
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("images/") + fileName);
}