1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 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 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));
- 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;
- }
- }
- }
|