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

风格不统一 提交于 2019-12-25 07:39:44

问题


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?


回答1:


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);
    }
});


来源:https://stackoverflow.com/questions/24727116/blueimp-jquery-file-upload-hide-file-from-queue-after-upload-done-responce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!