/// <summary> /// 上传 /// </summary> /// <returns></returns> public ActionResult Upload() { string operation = WebHelper.GetQueryString("operation"); if (operation == "ueconfig") { StringBuilder imageAllowFiles = new StringBuilder("["); foreach (string imgType in StringHelper.SplitString(mallConfigInfo.UploadImgType)) { imageAllowFiles.AppendFormat("\"{0}\",", imgType); } if (imageAllowFiles.Length > 1) { imageAllowFiles.Remove(imageAllowFiles.Length - 1, 1); } imageAllowFiles.Append("]"); string imageUrlPrefix = string.IsNullOrEmpty(mallConfigInfo.UploadServer) ? "/" : mallConfigInfo.UploadServer; return(Content(string.Format("{0}\"imageActionName\": \"uploadimage\", \"imageFieldName\": \"upfile\", \"imageMaxSize\": {1},\"imageAllowFiles\": {2}, \"imageCompressEnable\": true, \"imageCompressBorder\": 1600, \"imageInsertAlign\": \"none\", \"imageUrlPrefix\": \"{3}\", \"imagePathFormat\": \"\", \"imageManagerActionName\": \"listimage\",\"imageManagerListPath\": \"upload/image\",\"imageManagerListSize\": 20, \"imageManagerUrlPrefix\": \"/ueditor/net/\",\"imageManagerInsertAlign\": \"none\", \"imageManagerAllowFiles\": [\".png\", \".jpg\", \".jpeg\", \".gif\", \".bmp\"]{4}", "{", mallConfigInfo.UploadImgSize, imageAllowFiles, imageUrlPrefix, "}"))); } if (operation == "uploadproductimage")//上传商品图片 { int storeId = WebHelper.GetQueryInt("storeId"); HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveUplaodProductImage(storeId, file); return(Content(result)); } if (operation == "uploadproducteditorimage")//上传商品编辑器中图片 { int storeId = WebHelper.GetQueryInt("storeId"); HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveProductEditorImage(storeId, file); return(Content(string.Format("{3}'url':'upload/store/{0}/product/editor/{1}','state':'{2}'{4}", storeId, result, GetUEState(result), "{", "}"))); } if (operation == "uploadstorebanner")//上传店铺banner { int storeId = WebHelper.GetQueryInt("storeId"); HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveUploadStoreBanner(storeId, file); return(Content(result)); } if (operation == "uploadstorelogo")//上传店铺logo { int storeId = WebHelper.GetQueryInt("storeId"); HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveUploadStoreLogo(storeId, file); return(Content(result)); } if (operation == "uploadadvertbody")//上传广告主体 { HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveUploadAdvertBody(file); return(Content(result)); } if (operation == "uploadbannerimg")//上传banner图片 { HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveUploadBannerImg(file); return(Content(result)); } if (operation == "uploadnewseditorimage")//上传新闻编辑器中的图片 { HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveNewsEditorImage(file); return(Content(string.Format("{2}'url':'upload/news/{0}','state':'{1}'{3}", result, GetUEState(result), "{", "}"))); } if (operation == "uploadbrandlogo")//上传品牌logo { HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveUploadBrandLogo(file); return(Content(result)); } if (operation == "uploadhelpeditorimage")//上传帮助编辑器中的图片 { HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveHelpEditorImage(file); return(Content(string.Format("{2}'url':'upload/help/{0}','state':'{1}'{3}", result, GetUEState(result), "{", "}"))); } if (operation == "uploadfriendlinklogo")//上传友情链接logo { HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveUploadFriendLinkLogo(file); return(Content(result)); } if (operation == "uploaduserrankavatar")//上传用户等级头像 { HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveUploadUserRankAvatar(file); return(Content(result)); } if (operation == "uploadstorerankavatar")//上传店铺等级头像 { HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveUploadStoreRankAvatar(file); return(Content(result)); } return(HttpNotFound()); }