1

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').submit() - 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']) ?

2 Answers 2

1

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

0

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');
        }
1
  • That approach is currently giving me empty $_POST['uploader_xx values, as if no files where uploaded at all.. May 22, 2011 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.