Skip to content Skip to sidebar Skip to footer

Jquery Multiple File Upload Limit Number Of Files Not Working

Jquery multiple file upload with ajax. option : { limitMultiFileUploads : 3 } is not working for jquery file upload. This is what i did : $(function() {

Solution 1:

You are actually looking for maxNumberOfFiles option.

More details on the doc: https://github.com/blueimp/jQuery-File-Upload/wiki/Options

My working code:

$('#fileupload').fileupload({
        // Uncomment the following to send cross-domain cookies://xhrFields: {withCredentials: true},url: '../uploaderDemo/server/php/',
        maxNumberOfFiles: 1,
        acceptFileTypes: /(\.|\/)(mp3|wav)$/i
    });

Solution 2:

Get rid of the object with the name "option" and put the two settings at the same level as the rest of the options.

 $(function() {        
            $('#attachUpload').fileupload({            
                dataType: 'json',
                limitConcurrentUploads: 1,
                maxFileSize: 40000,
                maxNumberOfFiles: 2,
                start: function(e) {
                    $('.btn-sent').unbind('click'); // important - remove all event handlers
                },
                done: function(e, data) {
                    var data = $.parseJSON(data._response.jqXHR.responseText);
                    doneflag--;
                    if (doneflag == 0) {                                              
                            $('#frmCompose').submit();                       
                    }
                },
                submit: function(e, data) {                
                    data.formData = setFormData();                
                },
                add: function(e, data) {
                }
    });

Post a Comment for "Jquery Multiple File Upload Limit Number Of Files Not Working"