public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Request.ContentEncoding = Encoding.GetEncoding("UTF-8"); context.Response.ContentEncoding = Encoding.GetEncoding("UTF-8"); context.Response.Charset = "utf-8"; string fileListID = Common.DNTRequest.GetQueryString("FileID"); //文件ID string singleProjectID = Common.DNTRequest.GetQueryString("SingleProjectID"); //工程ID HttpPostedFile file = context.Request.Files["Filedata"]; string uploadPath = string.Concat(Common.Common.EFileStartPath, singleProjectID, "\\ODOC\\"); if (file != null) { string fileName = PublicModel.UpLoadImage1(file, uploadPath); if (fileName.IndexOf("Error") < 0)//表示文件上传成功 { UpdateFile(singleProjectID, fileListID, fileName, file.FileName); } //下面这句代码缺少的话,上传成功后上传队列的显示不会自动消失 context.Response.Write("1"); } else { context.Response.Write("0"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Request.ContentEncoding = Encoding.GetEncoding("UTF-8"); context.Response.ContentEncoding = Encoding.GetEncoding("UTF-8"); context.Response.Charset = "utf-8"; string pid = Common.DNTRequest.GetQueryString("ID");//组ID string SingleProjectID = string.Empty; string BH = string.Empty; T_FileList_MDL filelistMDL = filelistBLL.GetModel(ConvertEx.ToInt(pid)); if (filelistMDL != null) { SingleProjectID = filelistMDL.SingleProjectID.ToString(); BH = filelistMDL.BH; } HttpPostedFile file = context.Request.Files["Filedata"]; string uploadPath = string.Concat(Common.Common.EFileStartPath, "\\SXImage\\", SingleProjectID + "\\"); if (file != null) { if (!Directory.Exists(uploadPath)) { Directory.CreateDirectory(uploadPath); } string thumbFilePath = string.Concat(uploadPath, "\\thumb\\"); if (!Directory.Exists(thumbFilePath)) { Directory.CreateDirectory(thumbFilePath); } string fileName = PublicModel.UpLoadImage1(file, uploadPath, thumbFilePath, 200, 140); if (fileName.IndexOf("Error") < 0)//表示文件上传成功 { InSertFile(pid, BH, SingleProjectID, fileName, uploadPath); } //下面这句代码缺少的话,上传成功后上传队列的显示不会自动消失 context.Response.Write("1"); } else { context.Response.Write("0"); } }