Search code examples
javascriptjqueryjquery-file-uploadblueimp

Blueimp jQuery File Upload - hide file from queue after upload done responce


I'm using Blueimp jQuery File Upload plugin and my configuration is:

$('#fileupload').fileupload({
    // Uncomment the following to send cross-domain cookies:
    //xhrFields: {withCredentials: true},                
    url: 'assets/plugins/jquery-file-upload/server/php/',
    done: function (e, data) {
        //some code
    }
});

When one file upload is done, I need to hide this file from list in done: event, but I cant get index of this file in queue list.

Any ideas?


Solution

  • Found a solution regarding my question.

    jQuery Fileupload returns data on done event, which contains context parameter per uploaded thread, which is relevant to DOM element and can be used for any manipulations like hiding in my case:

     $('#fileupload').fileupload({
        // Uncomment the following to send cross-domain cookies:
        //xhrFields: {withCredentials: true},                
        url: 'assets/plugins/jquery-file-upload/server/php/',
    
        done: function(e, data) {
            //hide completed upload element in queue
            $(data.context['0']).fadeOut(700);
    
            //here isoutput of uploaded objects
            console.log(data.result);
        }
    });