Topic: Help with submitting form

I have successfully set up plupload as a jQuery queue widget and am able to upload photos. The issue I'm having is when files have been selected, or are currently uploading and the Submit button of my form gets clicked. The files will either begin downloading, or continue downloading, but once complete, I get no file information posted. This is how the example works also. Check it:
http://www.plupload.com/example_queuewidget.php
Select files, then click send.

Is there any way to get around this? Or am I missing anything. It would be great if the submit button would trigger uploads, then post all the data when the uploads are complete.

I can post code, but as it is how the example work, I don't think its necessary at this point.

Re: Help with submitting form

Not sure if you are talking about exactly the same thing, but perhaps this thread from earlier today would be helpful:

http://www.plupload.com/punbb/viewtopic.php?id=872

Re: Help with submitting form

Sorry Mike, not really on the same track. That one is trying to return data for an uploaded file.

My issue is that when I click my form submit button to start the upload, or click it while during upload, the form tries to post when the queue finishes, but the page just refreshes and file data doesn't get posted.

If I start the upload with the "Start Upload" button, and wait for the queue to finish, then press submit, it comes through okay.

I'm thinking a solution would be disable the submit button until an event 'queue finished' occured, then enable to button. Does that make sense?

Re: Help with submitting form

Can you share some code?  What you are talking about sounds like an unusual implementation.

5 (edited by zeilstar 2011-05-17 21:01:11)

Re: Help with submitting form

I'm hardly doing anything out of the ordinary. Even the example works this way.

http://www.plupload.com/example_queuewidget.php
Try hitting [Add Files] then [Send].

Here is some stripped down code I'm using.

<!-- load queue widget css and jquery -->
<style type="text/css">@import url(css/plupload.queue.css);</style>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
    google.load("jquery", "1.3");
</script>


<!-- load plupload runtimes -->
<script type="text/javascript" src="/plupload/js/plupload.full.js"></script>
<!-- and jquery widget -->
<script type="text/javascript" src="/plupload/js/jquery.plupload.queue.js"></script>

<?php

print_r($_POST);

if(isset($_POST['submit'])){ //if form was submitted

    echo 'form was submitted';
    
    //do stuff here to posted images/data
    //i.e. rename, move, and create db record, etc
    

} else { //display record creation stuff
?>
<div>
    <form id="create" name="create" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" >
        <!-- input fields -->
        <div id="uploader"> <!-- becomes a pluploader on page load -->
            <p>Your browser doesn't have HTML5, Flash, or HTML4 support.</p>
        </div>

        <input type="submit" name="submit" value="Create Records"/>
    </form>
</div>

<script type="text/javascript">
    $(function() {
        // Convert divs to queue widgets when the DOM is ready
        $("#uploader").pluploadQueue({
            // General settings
            runtimes : 'html5,flash,html4',
            url : 'pictures-upload.php',
            max_file_size : '3mb',
            
            // Resize images on clientside if we can
            //resize : {width : 300, height : 200, quality : 90},
            //causes issue with futher resizing
            //html5 - only works for FF3.5+, not on WebKit/Opera

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

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

        });

        // Client side form validation
        $('form').submit(function(e) {
            var uploader = $('#uploader').pluploadQueue();

            // Validate number of uploaded files
            if (uploader.total.uploaded == 0) {
                // Files in queue upload them first
                if (uploader.files.length > 0) {
                    // When all files are uploaded submit form
                    uploader.bind('UploadProgress', function() {
                        if (uploader.total.uploaded == uploader.files.length){
                            alert('submitting the form');
                            //document.create.submit();
                            $('form').submit();
                        }
                    });

                    uploader.start();
                } else
                    alert('You must at least upload one file.');

                e.preventDefault();
            }
        });
        
    });
</script>
<?php
}
?>

Re: Help with submitting form

A workaround from another thread:
Issue submitting the form

Re: Help with submitting form

i have the same problem, thank you i found this post.

gclub casino
gclub คา สิ โน ออนไลน์