首页 > 代码库 > HttpPostedFileBase 基类
HttpPostedFileBase 基类
public void uploadDocMentSave(string Type)
{
if (Request.Files.Count > 0)
{
HttpPostedFileBase files = Request.Files[0];//获取文件
string filename = Path.GetFileName(files.FileName); //获取文件的名称
int index = filename.IndexOf(".");
int namelength = filename.Length;
string HouzuiName = filename.Substring(index, filename.Length - index);
string newName = string.Format("{0:yyyyMMddHHmmssffff}", DateTime.Now) + HouzuiName;
//得到文件的名称
string path = HttpContext.Server.MapPath("file://content//resources//uploadfile//WorkFlow//") + newName;
files.SaveAs(path);
}
}