- if (Request.Files.Count != 0)
- {
- HttpPostedFile MyUpFile = Request.Files["file"];
- if (!string.IsNullOrEmpty(MyUpFile.FileName))
- {
- string fileName=Path.GetFileName(MyUpFile.FileName);
- filePath = ConfigurationManager.AppSettings["AttPath"] + "/Accessories/";
- filePath = filePath + project.ProjectID + "/";
- string folder = Function.CreateRandomDirectoryFolder(filePath) + "/";
- filePath = filePath + folder;
- filePath = filePath + fileName;
- MyUpFile.SaveAs(filePath);
- url = ConfigurationManager.AppSettings["AttUrl"];
- url += "/Accessories/" + project.ProjectID + "/" + folder + fileName;
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/280620134353.html
来源: http://www.codesnippet.cn/detail/280620134353.html