开发者

plupload submit on queue complete

Using plupload jquery queue plugin as in this example, how can I submit the form on upload complete? I attempted to add a <input type="submit" /> button, and click this button without first clicking the Start upload. This triggers the uploader.start() correctly, and then $('form').s开发者_StackOverflowubmit() - however the $_POST data only contains: 'uploader_count' => string '0' (length=1). If I first click the Start upload button however, the proper POST vars are populated.

How can I trigger .submit() and be sure the correct file upload post parameters are present (E.G. $_POST['uploader_count']) ?


Turns out this is a bug in plupload, and is also present in the official example at:

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

(Queing files, then hit submit only sends POST data $_POST['uploader_count'] == 0) omitting any file info


We added a button which does this:

    var plupload = form.find('.plupload-element'), uploader;
    event.preventDefault();
    if (plupload.length && plupload.pluploadQueue) {
      uploader = plupload.pluploadQueue();
      uploader.bind('StateChanged', function(uploader) {
        // Submit the form if all the files got uploaded.
        if (uploader.total && uploader.files && uploader.total.uploaded === uploader.files.length) {
          form.trigger('submit');
        }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜