public ActionResult UploadFile(int keyValue, dm_articleEntity entity) { entity.content = HttpUtility.UrlDecode(entity.content); HttpFileCollection files = System.Web.HttpContext.Current.Request.Files; if (files.Count > 0) { if (files[0].ContentLength == 0 || string.IsNullOrEmpty(files[0].FileName)) { return(HttpNotFound()); } UserInfo userInfo = LoginUserInfo.Get(); /*string FileEextension = Path.GetExtension(files[0].FileName); * string virtualPath = $"/Resource/GoodImage/{Guid.NewGuid().ToString()}{FileEextension}"; * string fullFileName = base.Server.MapPath("~" + virtualPath); * string path = Path.GetDirectoryName(fullFileName); * Directory.CreateDirectory(path); * files[0].SaveAs(fullFileName); * entity.a_image = virtualPath;*/ string appid = userInfo.IsEmpty() ? "e2b3ec3a-310b-4ab8-aa81-b563ac8f3006" : userInfo.companyId; entity.a_image = OSSHelper.PutObject(dM_BaseSettingIBLL.GetEntityByCache(appid), "", files[0]); } dM_ArticleIBLL.SaveEntity(keyValue, entity); return(Success("保存成功。")); }
public ActionResult SaveForm(int keyValue, dm_articleEntity entity) { dM_ArticleIBLL.SaveEntity(keyValue, entity); return(Success("保存成功!")); }