Topic: Core API, Plupload UI, PluploadQueue - what's the difference?..

Hi again folks,

Some example use Plupload, other use PluploadQueue, and I can really see a visual difference.

So what's the difference between

var uploader = $("#uploader").plupload({...});

and

$("#uploader").pluploadQueue({...});

?

Also, it seem that pluploadQueue returns nothing. I've not been able to bind event on the returned object, like:

var uploader = $("#uploader").pluploadQueue({...});
uploader.bind('FileUploaded', function(Up, File, Response) {
            if( (Uploader.total.uploaded + 1) == Uploader.files.length)
            {
                console.log($("#uploadForm").serialize());
                alert('test');
                //$("#uploadForm").submit();
                console.log('submit');
            }
        });

I must use a preinit: attachCallbacks option.


As you see, I've no precise question about that. I just can't find a general explaination in the doc (yet), so I'm asking... I might not be the only one who's having a hard time to figure the plupload vs pluploadQueue difference wink

Thanks !

Re: Core API, Plupload UI, PluploadQueue - what's the difference?..

Actually there is a difference and it's not only visual, but also functional. Demos for both of them are available here: Queue and UI accordingly. Widgets have a different code as well - Queue widget is jQuery based (basically a jQuery plugin), while UI widget is jQuery UI based (UI widget).

Source code for examples is faulty (Issue #209), so you better reference example code from the bundle.

Also I should note that in general Plupload doesn't depend on jQuery or any othe JS libraries, widgets are provided only for convenience and as examples of how one might implement Plupload Core API into a functional uploader component (check Custom Upload for purely Core Plupload API based example).

Hope that brings some light to the problem.

If you want to see your issue fixed, do not report it here, do it on - GitHub.

Re: Core API, Plupload UI, PluploadQueue - what's the difference?..

Thanks for the reply, but I'm still unsure about the difference between the Plupload object and the PluploadQueue object...

So far, here's what I understand (correct me if I'm wrong):
- Plupload is the core object, it handle the basic functionnality, but does not create any HTML interface, and does not try to control any HTML object.

- PluploadQueue is a widget that use Plupload. His responsability is to manage the User Interface (HTML code) and to link (bind) it correctly to the Plupload class.

- The Jquery UI widget is a replacement of PluploadQueue, used to have a JQueryUI based interface. But JQueryUI widget must not be directly instanciated as you would to with PluploadQueue. Instead, you must instanciate Plupload, and simply by including the /plupload/js/jquery.ui.plupload.min.js file, it will automatically find (all ?) the plupload instances and replace it with the JQueryUI Interface.


---------

That whould explain why we can't directly bind event to PluploadQueue, and need to use the init or preinit option in the constructor in order to bind event. Example - this will works:

$("#uploader").pluploadQueue({ init: attachCallbacks });

function attachCallbacks(Uploader) {
        $('#startUpload').click(function(e) {
                alert('test');
        });
}

Example - this would not:

$("#uploader").pluploadQueue({}).click(function(e){ alert('test'); });

Example - this would also doesn't work:

var objTest = $("#uploader").pluploadQueue({});
objTest.click(function(e){ alert('test'); });

So that worth me a new question:
From my last example, how could I get the Plupload instance of the objTest variable -- without using the constructor as I did in the first example ?


Ps.: I know for the faulty example, I'm the one who repported the issue 209 wink

Re: Core API, Plupload UI, PluploadQueue - what's the difference?..

Almost, but not exactly. Core API (runtimes) creates input element, which when clicked opens file dialog. The rest is upon developer - he is the one to start upload, to handle progress and complete events.

Widgets - Queue and UI on the other hand encapsulate that additional logic and provide particular html structure and look. That's it. Similar widget (I use to call it - implementation) can be written not only in jQuery, but in Prototype, Mootools, Dojo, ExtJS and so on, and have an arbitrary look - just how developer decides.

This is how you get uploader instance:

// in Core API
var uploader = new plupload.Uploader({
...
});

// for Queue widget
$("#uploader").pluploadQueue({
...
});
var uploader = $("#uploader").pluploadQueue(); // notice blank parenthesis 

// for UI widget
$("#uploader").plupload({
...
});
var uploader = $("#uploader").plupload('getUploader');

Then... after you get uploader instance you bind event listeners to it, as shown in the examples.

I guess that's it by now. Later on, in coming documentation I describe how one could bind to events in Queue in UI way.

If you want to see your issue fixed, do not report it here, do it on - GitHub.

Re: Core API, Plupload UI, PluploadQueue - what's the difference?..

The main thing - Plupload itself - is really just a Core API. The rest are optional additions, extensions, implementations, widgets, etc smile

If you want to see your issue fixed, do not report it here, do it on - GitHub.

Re: Core API, Plupload UI, PluploadQueue - what's the difference?..

Thanks Davit, this was good information and I'm certain I am going to use it.

Re: Core API, Plupload UI, PluploadQueue - what's the difference?..

Demos for both of them are available here: Queue and UI accordingly. Widgets have a different code as well - Queue widget is jQuery based (basically a jQuery plugin), while UI widget is jQuery UI based (UI widget).

Thanks for clarifing...

Re: Core API, Plupload UI, PluploadQueue - what's the difference?..

I'm having an issue with multiple PluploadQueue elements on a page.  I've tried to follow this(http://www.plupload.com/punbb/viewtopic.php?id=564) and this (http://www.plupload.com/punbb/viewtopic.php?pid=2559 and this(http://www.plupload.com/punbb/viewtopic.php?id=1029), but they are all examples of the Plupload object, not the Queue object.

Is it possible to do multiples of the Queue, and if so, can someone show some working code?  Thanks!

Re: Core API, Plupload UI, PluploadQueue - what's the difference?..

Thank you so much mate, I have long time looking for this info about Core API and I'm really happy.