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();   
                }
            });
        }
    });
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top