关闭UploadCare对话框后,我希望显示警报,但不会显示。为什么不?''
$('#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;
});
您已订阅openDialog().done()
。用户选择文件并在对话框中单击“完成”时,将调用此回调。在此回调中,您将接收file
对象并订阅file.fail()
回调。当由于网络错误或验证器不满意而导致文件上传失败时,将调用此回调。
如果要在用户关闭对话框时不选择文件而订阅回调(通过单击右上角的×或按ESC),则应订阅openDialog().fail()
:
$('#uc_open').on('click', function() {
// Open the dialog on button cick
uploadcare.openDialog(null, {
imagesOnly: true
}).done(function(file) {
// User has just clicked "Done" in Uploadcare dialog
file.done(function(fileInfo) {
// File uploading succeeded
});
}).fail(function(error, fileInfo) {
// User just has closed the dialog by pressing ESC or clicking on "×"
alert(error);
});
return false;
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句