When the UploadCare dialog is closed I expect the alert to show, but it doesn't. Why not?''
$('#uc_open').on('click', function() {
uploadcare.openDialog(null, {
imagesOnly: true
}).done(function(file) {
file.done(function(fileInfo) {
//
}).fail(function(error, fileInfo) {
alert(error);
});
});
return false;
});
You have subscribed to
openDialog().done()
. This callback will be called when user choose a file and click "done" in dialog. In this callback you receivefile
object and subscribe tofile.fail()
callback. This callback will be called when file uploading will be failed due to network error or unsatisfied validators.If you want to subscribe to callback when user close dialog without choosing file (by clicking × in upper right corner, or by pressing ESC), you should subscribe to
openDialog().fail()
: