using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; using OPSS.Logic.FileManage; using OPSS.Public.SysFrame; public partial class Include_DocUpLoad : System.Web.UI.Page { protectedvoid Page_Load(object sender, EventArgs e) { try { string fileName = Request.Files[0].FileName; string rootPath = AppConfig.RootPath; //检查配置项是否存在 if (AppConfig.RootPath.Length <1|| AppConfig.RootPath.LastIndexOf(@"\") == (AppConfig.RootPath.Length -1)) { thrownew Exception(@"缺少目录配置项或目录配置项以\结尾"); } //检查存储目录是否存在,如果不存在创建目录。 if (!Directory.Exists(rootPath)) { Directory.CreateDirectory(rootPath); } string fullFileName = AppConfig.RootPath+"\\"+DateTime.Now.ToString("yyyyMMddHHmmss")+fileName; //如果文件存在会覆盖。 Request.Files[0].SaveAs(fullFileName); Response.Write(fullFileName); Response.End(); } catch (Exception ex) { } } }