.net core百度编辑器上传图片配置
电脑版发表于:2020/1/28 19:39
.net core百度编辑器上传图片配置和.net framework还是有一点点区别
public ActionResult UploadImage(List<IFormFile> files) { var action = Request.Query["action"]; var json = ""; //第一次加载,用于百度编辑器验证配置的后台地址是否可用 if (action == "config") { json = @"{""imageActionName"":""UploadImage"",""imageFieldName"": ""upfile"",""imageCompressEnable"":""true"",""imageCompressBorder"": 1600,""imageInsertAlign"": ""none"",""imageUrlPrefix"": """",""imageAllowFiles"": ["".png"", "".jpg"", "".jpeg"", "".gif"", "".bmp""]}"; } else { //处理图片上传的逻辑....... var jsonobj = new { url = "你上传图片保存的位置,希望浏览器显示图片的url链接", state = "SUCCESS" }; json = JsonConvert.SerializeObject(jsonobj); } return new ContentResult { ContentType = "application/json;charset=UTF-8", Content = json }; }