简体   繁体   中英

Blueimp file upload error message for invalid files

I've limited blueimp file upload plugin to certain file types/sizes in the upload.php handler.

The plugin is working fine for the correct file types (json) within the size limits but for other file types, it doesn't upload (as expected) but it isn't throwing any error message.

This is the code I'm using:

$('#fileupload').fileupload({
        dataType: "json",
        done: function (e, data) {
            $.each(data.result.files, function (index, file) {
                if(file.error != null){
                    $('#consola').text(file.error);
                };
                myfunction();
            });
        }
    });

I've also tried:

$('#fileupload').fileupload({
        dataType: "json",
        done: function (e, data) {
            $.each(data.result.files, function (index, file) {
                if(file.error){
                    $('#consola').text(file.error);
                };
                myfunction();
            });
        },
    });

Why is the error message not displayed?

This worked:

$('#fileupload').fileupload({
        dataType: "json",
        done: function (e, data) {
            $.each(data.result.files, function (index, file) {
                if(file.error !=null){
                    $('#consola').text(file.error);
                    animarTexto();
                } else {
                    myFunction();   
                }
            });
        }
    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM