English 中文(简体)
Refresh plupload
原标题:
  • 时间:2011-01-18 05:57:13
  •  标签:
  • plupload

I m using plupload.

How do you reset the uploader after the transfer queue completes, so the user can upload more files if they want?

最佳回答

uploader.splice(); will remove all files from the queue and make uploader object ready to start over.

问题回答
uploader.splice();

uploader.refresh();

In that sequence... Works on jquery.ui mode.

There is now an option to automatically reset the queue widget once uploads are complete.

http://www.plupload.com/documentation.php

multiple_queues

Boolean state if you should be able to upload multiple times or not.

jayarjo s solution removes the files from the uploader, but doesn t restore the Add/upload buttons.

This one works...

http://www.plupload.com/punbb/viewtopic.php?pid=1360#p1360

In this sequence:

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

I m using a function that was resetting the form with some other content but was unable to reset plupload. I don;t mind that it does not come again the Drag Files here text, although I think that it can be monkeyed.. It might have something to do with the count. For instance, I have these params:

                   uploader_0_name          account-disabled-1.png
                   uploader_0_status    done
                   uploader_count           1

Perhaps removing these inputs is not a good idea, but restoring them to their initial state could work.. I will look into that and come back as it develops.. Thanks for the nice advices.

I bind to the UploadComplete event to remove and re-initialize the plupload object when the upload completes. It turned out to be the best implementation for me.

With this implementation, just call init_uploader() to initialize- in this case, on jquery page load complete.

HTML:

<div id="uploader_wrapper"></div>

Javascript:

function init_uploader()
{
    $("#uploader_wrapper").append( <div id="uploader"><img src="/images/loading.gif" /></div> );

    $("#uploader").pluploadQueue({
        runtimes:  html5,html4,gears,browserplus,flash,silverlight ,
        url:  some_url ,
        max_file_size:  10mb ,
        chunk_size:  1mb ,
        unique_names: true,
        filters: [
            { title: "Image files", extensions: "jpg,gif,png,jpeg" }
        ],
        flash_swf_url:  http://www.plupload.com/plupload/js/plupload.flash.swf ,
        silverlight_xap_url:  http://www.plupload.com/plupload/js/plupload.silverlight.xap 
    });

    var uploader = $( #uploader ).pluploadQueue();

    uploader.bind("UploadComplete", function () {
        $("#uploader").remove();
        init_uploader();
    });
}

$(function () {
    init_uploader();
});




相关问题
Uploading multiple files to blobstore (redux)

Yes, I ve seen this question already, but I m finding information that contradicts its accepted answer and Nick Johnson s blog on the GAE docs. The docs talk about uploading more than one file at ...

plupload with ASP.NET forms authenticated handler

I am trying to use plupload to upload files in ASP.NET. My upload handler ideally needs to be included in the forms authentication on my site, but it doesn t work in this case. I can t see the ...

Refresh plupload

I m using plupload. How do you reset the uploader after the transfer queue completes, so the user can upload more files if they want?

Modify the file parameters in plupload

I am using plupload. I cannot find a way to edit the name that the upload script sets for the file I am uploading. Is there a way to change the file name?

How to use the plupload package with ASP.NET MVC?

I am using plupload version 1.3.0 More specifically how I have to define my controller action to support chunking? Can I use the HttpPosteFileBase as a parameter? At the moment I am using the ...

Error: Allowed memory size of 67108864 bytes exhausted

When I upload a picture File size: 375kb Width: 2000px Height: 3000px I get an error ERROR Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 2157 bytes) in... ...

Plupload upload filename issues

I have been successful in porting over plupload into Codeigniter, but when a user uploads a file, the filename comes out like this: _1, _2, _3, etc. What could be causing this error? Here is my ...

热门标签