Search code examples
jqueryfile-uploadblueimp

jQuery File Upload blueimpl browser freeze


Im using Jquery File Upload bluempl for uploading files. When i upload lot of number of files like 6000 files using this plugin the browser hangs and freeze many times, alothough when visiting the folder in server/files i can see the files been uploaded. can you tell what kind of optimization or parameter i can use for uploading many files without the browser freeze. Im using as example the one in basic.hml of the example file :

$(function () {
    'use strict';
    // Change this to the location of your server-side upload handler:
    var url = window.location.hostname === 'blueimp.github.io' ?
                '//jquery-file-upload.appspot.com/' : 'server/php/';
    $('#fileupload').fileupload({
        url: url,
        dataType: 'json',
        done: function (e, data) {
            $.each(data.result.files, function (index, file) {
                $('<p/>').text(file.name).appendTo('#files');
            });
        },
        progressall: function (e, data) {
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#progress .progress-bar').css(
                'width',
                progress + '%'
            );
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');
});

Thanks in advance.


Solution

  • It looks like synchronous upload is the default in blueimp.

    Browser freezes have often to do with synchronous instead of asynchronous javascript requests.

    Blueimp describes how to upload asynchronously: https://github.com/blueimp/jQuery-File-Upload/wiki/Submit-files-asynchronously

    Update

    1. Ok, the add method described on the page above is just called when files are added to the queue

    2. The options documentation contains parameters sequentialUploads and limitConcurrentUploads, please try using them or one of them.