0

I am trying to trigger the plupload.start() event from a jQuery modal dialog button, but it seems like the plupload object is not recognized, thus giving me the following error:

TypeError: Object #<Object> has no method 'start'

I initialized the plupload object on the dialog's opening event, I can upload files correctly using the original button, but I prefer sending the files and the form in a standard layout (instead having two "upload" buttons, the one for the form and the one for the plupload plugin).

I don't want to trigger the upload right on the FileAdded event either. Anyone has an idea on how to proceed?

Initialization code:

$("#uploader").plupload({
                // General settings
                runtimes : 'flash,html5,html4',
                url : 'pagesPub/update_pub.php',
                max_file_size : '25mb',
                chunk_size : '25mb',
                unique_names : true,

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

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

                // Silverlight settings
                silverlight_xap_url : 'js/moxie/plupload.silverlight.xap',

                FilesAdded : function (up, files) {
                    var fileCount = up.files.length,
                    i = 0,
                    ids = $.map(up.files, function (item) { return item.id; });

                    for (i = 0; i < fileCount; i++) {
                        uploader.removeFile(uploader.getFile(ids[i]));
                    }

                    // Do something with file details
                }

            });
2
  • Check whether jQuery-object returned by $('#uploader') is empty when you invoke it. Commented Dec 19, 2012 at 13:34
  • Yes, the jQuery object is valid and contains a lot of stuff. Commented Dec 19, 2012 at 13:38

1 Answer 1

1

plupload.start() is the wrong way to call the method (since it's a jQuery object).

You must call it this way:

$('#uploader').plupload('start');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.