Blueimp jQuery File Upload-上传完成后,从队列中隐藏文件 [英] Blueimp jQuery File Upload - hide file from queue after upload done responce

查看:250
本文介绍了Blueimp jQuery File Upload-上传完成后,从队列中隐藏文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Blueimp jQuery File Upload插件,我的配置是:

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

一个文件上传完成后,我需要在done:事件中将其隐藏在列表中,但无法在队列列表中获取该文件的索引.

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.

有什么想法吗?

推荐答案

找到了有关我的问题的解决方案.

Found a solution regarding my question.

jQuery Fileuploaddone事件上返回数据,该事件在每个上载线程中包含context参数,该参数与DOM元素相关,并且可用于任何操作,例如在我的情况下隐藏:

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

这篇关于Blueimp jQuery File Upload-上传完成后,从队列中隐藏文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆