//public JsonResult ImgUpload(FormCollection collection) public JsonResult ImgUpload(HttpPostedFileBase file, string temp, string fileIdx) { AjaxResponseModel response = new AjaxResponseModel(); response.Success = false; string fileName = string.Empty; //HttpPostedFileBase imgupload = Request.Files["file"]; if (file != null) { if (file.ContentLength > 0) { string[] extType = { ".jpg", ".png", ".gif" }; string extension = Path.GetExtension(file.FileName).ToLower(); if (extType.Contains(extension)) { fileName = new UploadFunc().FileUpload(file, ImageSize.GetArticleResize(), "Article", null); ArticleFileT articleFileT = new ArticleFileT(); articleFileT.FileGubun = "temp"; articleFileT.FileType = "img"; //articleFileT.MemberNo = profileModel.UserNo; articleFileT.MemberNo = 1; articleFileT.Seq = 5000; articleFileT.ImgUseYn = "U"; articleFileT.Ext = extension; articleFileT.ThumbYn = "Y"; articleFileT.MimeType = file.ContentType; articleFileT.Name = file.FileName; articleFileT.Size = file.ContentLength.ToString(); articleFileT.Rename = fileName; articleFileT.Path = "/Article/article_img/"; articleFileT.Width = "630"; articleFileT.Height = "470"; articleFileT.UseYn = "Y"; articleFileT.Temp = temp; articleFileT.RegIp = IPAddressHelper.GetIP(this); articleFileT.RegId = profileModel.UserId; articleFileT.RegDt = DateTime.Now; int articleFileNo = _articleFileDac.InsertArticleFile(articleFileT); response.Success = true; response.Result = articleFileNo.ToString(); } else { response.Message = "gif, jpg, png 형식 파일만 가능합니다."; } } } if (!string.IsNullOrEmpty(fileIdx)) { string[] idxArr = fileIdx.Split(','); if (idxArr.Length > 1) { _articleFileDac.UpdateArticleFileSeq(idxArr); } } return(Json(response, JsonRequestBehavior.AllowGet)); }