Browse Source

跨域上传图片时,不直接进行判断是否上传图片成功

master
Frank Liu 9 years ago
parent
commit
fb9859f5d4
  1. 23
      plugins/image-dialog/image-dialog.js

23
plugins/image-dialog/image-dialog.js

@ -134,14 +134,14 @@
if (fileName === "")
{
alert(imageLang.uploadFileEmpty);
return false;
}
if (!isImage.test(fileName))
{
alert(imageLang.formatNotAllowed + settings.imageFormats.join(", "));
return false;
}
@ -152,7 +152,7 @@
var uploadIframe = document.getElementById(iframeName);
uploadIframe.onload = function() {
loading(false);
var body = (uploadIframe.contentWindow ? uploadIframe.contentWindow : uploadIframe.contentDocument).document.body;
@ -160,13 +160,16 @@
json = (typeof JSON.parse !== "undefined") ? JSON.parse(json) : eval("(" + json + ")");
if (json.success === 1)
{
dialog.find("[data-url]").val(json.url);
}
else
if(!settings.crossDomainUpload)
{
alert(json.message);
if (json.success === 1)
{
dialog.find("[data-url]").val(json.url);
}
else
{
alert(json.message);
}
}
return false;

Loading…
Cancel
Save