MVC 中使用kindEditor 图片上传在IE 上进行上传出现的问题

mac2022-06-30  73

   在IE 上使用KindEditor 进行单张图片上传的时候会出现一个下载安全警告,这样将会造成图片上传失败,出现的错误页面:

 

 

 将会出现这样的一个警告信息。

解决方案,: 是将上传的UpdataloadDetailsImg 方法的返回值 修改为 void

错误代码:

public ActionResult UpdateloadDetailsImg() { string imageRemotePath = this.UploadImg(); if (!string.IsNullOrWhiteSpace(imageRemotePath)) { return Json(new { error = 0, url = string.Format("{0}{1}", Constant.WECHATMALL_IMAGE_URL, imageRemotePath) }); } return Json(new { error = 1, url = "上传图片发生错误!" }); }

修改后的代码:

public void UpdateloadDetailsImg() { string imageRemotePath = this.UploadImg(); if (!string.IsNullOrWhiteSpace(imageRemotePath)) { System.Web.HttpContext.Current.Response.ContentType = "text/html"; System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8; System.Web.HttpContext.Current.Response.Write(new { error = 0, url = string.Format("{0}{1}", Constant.WECHATMALL_IMAGE_URL, imageRemotePath) }.ToJson()); System.Web.HttpContext.Current.Response.End(); } else { System.Web.HttpContext.Current.Response.ContentType = "text/html"; System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8; System.Web.HttpContext.Current.Response.Write(new { error = 1, url = "上传图片发生错误!" }.ToJson()); System.Web.HttpContext.Current.Response.End(); } }

这样就可以轻松搞定了。

 

转载于:https://www.cnblogs.com/lizichao1991/p/5764557.html

相关资源:KindEditor解决ie6,ie7,ie8,ie9 浏览器兼容问题!
最新回复(0)