Plupload how to continue to upload after UploadComplete

萝らか妹 提交于 2019-11-30 14:38:14

I use to proceed somewhat like this (sorry, can't test it right now), embedding my initialization code in a function which I can call whenever I want.

va initUploader = function () {
    $("#uploader").pluploadQueue({
        // General settings
        runtimes: 'html5,gears,flash,silverlight,browserplus',
        url: '/upload.php',
        max_file_size: '10mb',
        chunk_size: '1mb',
        unique_names: true,

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

        // Flash settings
        flash_swf_url: '/assets/js/plupload/plupload.flash.swf',

        // Silverlight settings
        silverlight_xap_url: '/assets/js/plupload/plupload.silverlight.xap',

        init: {

            FilesAdded: function (up, files) {},
            UploadComplete: function (up, files) {
                // destroy the uploader and init a new one
                up.destroy();
                initUploader();
            }
        }
    });
};

$(document).ready(function(){initUploader();});

The Buttons you're looking for are still available but not displayed. So instead of reinitializing the Uploader, you can just change the display CSS option via JS, like that:

uploader.bind('UploadComplete', function() {
  $(".plupload_buttons").css("display", "inline");
  $(".plupload_upload_status").css("display", "inline");
})

Or if you are attaching your Events in the init function:

UploadComplete: function() {
  $(".plupload_buttons").css("display", "inline");
  $(".plupload_upload_status").css("display", "inline");
}

Note that im using jQuery in this example, but it would also work with plain JS.

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