JS display paste-upload errors directly
This commit is contained in:
parent
aaf22a34fb
commit
e5b867fc16
1 changed files with 8 additions and 0 deletions
|
|
@ -100,6 +100,7 @@ javascript:
|
||||||
if (file==null)
|
if (file==null)
|
||||||
{
|
{
|
||||||
console.log("File was null. Strange.");
|
console.log("File was null. Strange.");
|
||||||
|
display_error('Maybe the image was too large.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
|
|
@ -115,6 +116,7 @@ javascript:
|
||||||
error: function(xhr, txt, err)
|
error: function(xhr, txt, err)
|
||||||
{
|
{
|
||||||
console.log("AJAX file upload returned error: "+txt+" / "+err);
|
console.log("AJAX file upload returned error: "+txt+" / "+err);
|
||||||
|
display_error('Did you copy a proper image into your clipboard?');
|
||||||
},
|
},
|
||||||
success: function(res)
|
success: function(res)
|
||||||
{
|
{
|
||||||
|
|
@ -124,3 +126,9 @@ javascript:
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function display_error(msg)
|
||||||
|
{
|
||||||
|
$('#messages').html(
|
||||||
|
'<div class="callout alert alert-callout-subtle radius">Sorry, pasting did not work.' + msg + '</div>')
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue