如何清空plupload队列

时间:2012-12-15 00:02:05

标签: javascript jquery asp.net plupload

我正在尝试清空plupload队列,但它不起作用。我已经检查了几个SO问题并跟着他们,但没有一个对我有用。难道我做错了什么?

// Convert divs to queue widgets when the DOM is ready
$(function () {
    $("#uploader").pluploadQueue({
        // General settings
        runtimes: 'flash,html5,silverlight,browserplus,gears,html4',
        url: '<%= Page.ResolveUrl("~")%>Memories/HandlerAlbumUploader.aspx',
        max_file_size: '10mb',
        chunk_size: '1mb',
        unique_names: true,
        multiple_queues: true,
        // Resize images on clientside if we can
        //resize: { width: 320, height: 240, quality: 90 },

        // Specify what files to browse for
        filters: [
        { title: "Image files", extensions: "jpg,gif,png" }
    ],

        // Flash settings
        flash_swf_url: '<%= Page.ResolveUrl("~")%>Memories/js/plupload.flash.swf',

        // Silverlight settings
        silverlight_xap_url: '<%= Page.ResolveUrl("~")%>Memories/js/plupload.silverlight.xap',

        init: { StateChanged: function (up) {
            // Called when the state of the queue is changed
            if (up.state == plupload.STOPPED) {
                $('#<%=btnSubmit.ClientID%>').removeAttr('disabled');


            }
        }
        }
    });

    var uploader = $('#uploader').plupload('getUploader');
    uploader.splice();
    uploader.refresh();
});

1 个答案:

答案 0 :(得分:3)

您可能想要做的是点击按钮或链接,点击后会调用uploader.splice()

您还要为QueueChanged事件创建一个回调(使用uploader.bind()),这将通过您对splice()的调用触发。使此回调函数清除/重置代表队列的UI元素。

阅读文档,所有信息都在那里:http://www.plupload.com/plupload/docs/api/index.html#class_plupload.Uploader.html