/// <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")//上传商品图片 { HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveUplaodProductImage(storeInfo.StoreId, file); return(Content(result)); } if (operation == "uploadproducteditorimage")//上传商品编辑器中图片 { HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveProductEditorImage(storeInfo.StoreId, file); return(Content(string.Format("{3}'url':'upload/store/{0}/product/editor/{1}','state':'{2}'{4}", storeInfo.StoreId, result, GetUEState(result), "{", "}"))); } if (operation == "uploadstorebanner")//上传店铺banner { HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveUploadStoreBanner(storeInfo.StoreId, file); return(Content(result)); } if (operation == "uploadstorelogo")//上传店铺logo { HttpPostedFileBase file = Request.Files[0]; string result = MallUtils.SaveUploadStoreLogo(storeInfo.StoreId, file); return(Content(result)); } return(HttpNotFound()); }