123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using System;
- using System.Web;
- using System.IO;
- public partial class fileUploadAll : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload all Start"));
- try
- {
- HttpPostedFile fp = Request.Files["up_path"];
- if (Request.QueryString != null && Request.QueryString.Count > 0)
- {
- //C:\DfhConsent\UPLOAD\201610\28\100501967.jpg
- string up_filenm = Request.QueryString["up_path"].ToString();
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload: {0}", up_filenm));
- up_filenm = Server.MapPath(string.Format(@".\UPLOAD\{0}", up_filenm));
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload: {0}", up_filenm));
- foreach (string f in Request.Files.AllKeys)
- {
- HttpPostedFile file = Request.Files[f];
-
- // 디렉토리 존재여부 체크
- DirectoryInfo di = new DirectoryInfo(up_filenm.Substring(0, up_filenm.LastIndexOf("\\") + 1));
- if (di.Exists == false)
- {
- di.Create();
- }
- // 파일 저장
- file.SaveAs(up_filenm);
- }
- }
- else if (fp != null)
- {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("Request.QueryString"));
- fp = Request.Files["up_path"];
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("ANDROID File up_path"));
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(fp.FileName);
- string up_filenm = fp.FileName;
- //up_filenm = Server.MapPath(string.Format("./{0}", up_filenm));
- up_filenm = Server.MapPath(string.Format(@".\UPLOAD\{0}", up_filenm));
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload: {0}", up_filenm));
- // 디렉토리 존재여부 체크
- DirectoryInfo di = new DirectoryInfo(up_filenm.Substring(0, up_filenm.LastIndexOf("\\") + 1));
- if (di.Exists == false)
- {
- di.Create();
- }
- // 파일 저장
- fp.SaveAs(up_filenm);
- }
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm File Upload End"));
- }
- catch (Exception ex)
- {
- CLIP.eForm.Server.Diagnostics.LogHelper.LoggingHandler.Debug(string.Format("CLIP.eForm error: {0}", ex.Message));
- throw ex;
- }
- }
- }
|