标签:
HttpPostedFileBase uploadFile = Request.Files[file] as HttpPostedFileBase;
string fileN = uploadFile.FileName;//获取文件名称
if (fileN.IndexOf("\\") > 0) //如果有/ 说明是ie浏览器
{
fileN = fileN.Substring(fileN.LastIndexOf("\\") + 1, fileN.Length - fileN.LastIndexOf("\\") - 1);
}
fileN = DateTime.Now.ToString("yyyyMMddHHmmssffff") + Path.GetExtension(fileN);//设置文件名称
if (uploadFile != null && uploadFile.ContentLength > 0)
{
path = Path.Combine(pathForSaving, fileN);
uploadFile.SaveAs(path);
url += "/Upload/files/" + fileN;
int i = Request.Files.Count;
}
标签:
原文地址:http://www.cnblogs.com/JeffConrtoller/p/4309216.html