views:

49

answers:

1

I am working on an application that uses the plupload library for file uploading. I can't seem to get the file uploading working because there is some kind of error but I can't get this error to alert or log.

Has anyone been able to do this?

Here is my current code:

uploader.bind('Error', function(error){
                    console.log(error);
                });

Thanks in advance for any help!

A: 

Here is my entire code base for trying to get this to work

$('#plupload').pluploadQueue({
        runtimes : 'flash, html5',
        url : '/admin/upload/do_upload/',
        filters : [
            {title : "Image Files", extensions : "jpg,gif,png"}
        ],
        flash_swf_url : "/js/admin/plupload/plupload.flash.swf"
    });

    $('form').submit(function(e) {
        alert('EHY');
        var uploader = $('#plupload').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)
                        $('form').submit();
                });

                uploader.start();

                uploader.bind('Error', function(error){
                    console.log(error);
                });
            } else
                alert('You must at least upload one file.');

            e.preventDefault();
        }
    });
dennismonsewicz