1 (edited by enridp 2011-05-31 11:55:00)

Topic: FAQs

Can we make a FAQ?

simple and concise.

I'm starting the FAQ with these questions:
(please help to make this list bigger and better)

In the second post I will put the questions with answers, and in the third the qustions without answers to make it easy to read.

Regards !

PS: offtopic: why the creators of TinyMCE are not using it in this forum? sad

2 (edited by enridp 2011-06-12 01:50:20)

Re: FAQs

Where is a quick tutorial?

How to get the reference to uploader object?

// in Core API
var uploader = new plupload.Uploader({
...object with options here

// for Queue widget
...object with options here
var uploader = $("#uploader").pluploadQueue(); // notice blank parenthesis 

// for UI widget
...object with options here
var uploader = $("#uploader").plupload('getUploader');

you can learn more about the options accepted by plupload here:

What's the diffrence between custom uploader, Queue WIdget and UI Widget?
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.
Queue is a JQuery Plugin
UI is a JQuery UI Plugin

What are the limitations in Flash runtime?
If you are using image resize, the limit image size is:
you can read more here:
How to translate the widgets?
Just add something like this:

    'Select files' : 'Elija archivos:',
    'Add files to the upload queue and click the start button.' : 'Agregue archivos a la cola de subida y haga click en el boton de iniciar.',
    'Filename' : 'Nombre de archivo',
    'Status' : 'Estado',
    'Size' : 'Tamaño',
    'Add files' : 'Agregue archivos',
    'Stop current upload' : 'Detener subida actual',
    'Start uploading queue' : 'Iniciar subida de cola',
    'Uploaded %d/%d files': 'Subidos %d/%d archivos',
    'N/A' : 'No disponible',
    'Drag files here.' : 'Arrastre archivos aquí',
    'File extension error.': 'Error de extensión de archivo.',
    'File size error.': 'Error de tamaño de archivo.',
    'Init error.': 'Error de inicialización.',
    'HTTP Error.': 'Error de HTTP.',
    'Security error.': 'Error de seguridad.',
    'Generic error.': 'Error genérico.',
    'IO error.': 'Error de entrada/salida.',
    'Stop Upload': 'Detener Subida.',
    'Add Files': 'Agregar Archivos',
    'Start Upload': 'Comenzar Subida.',
    '%d files queued': '%d archivos en cola.'

TIP: there are many translations ready, you must download them from GIT:
and just add the "js" file after plupload.js.
for example:

<script type="text/javascript" src="js/plupload.js"></script>
<script type="text/javascript" src="js/es.js"></script>

NOTE: Also note that, at the time of writing this, there's an error in the translations, because the string replacement is case sensitive, 'Start Upload' should be 'Start upload'.

How to manage server response?
You can send anything you want from your server, and it will be accessible from these events:
see the docs: http://www.plupload.com/plupload/docs/a … leUploaded

Despite the name of those events, ther are not synonymous of a success upload and saved file, you can have an error in your server side. In that case you should return the error and do somehing with it in the above events.

for example:

uploader.bind('FileUploaded', function(up, file, info) {

How to manage errors?
For server side errors, see the above question.
For local errors you should listen (bind) the "Error" event. This event is triggered always with a "code" and a "message" (in english, you can translate it, see the next question).

NOTE: also you can receive a Server side error in the "Error" event if your server (or you) responds with a status other than 200.

How to translate errors?
In the same way that you translate the widgets. Also, if you are using the "js" files inside i18n folder (you need to download the sources from GIT) you probably have the errors translated too.

What are the errors returned in "Error" event?

Generic error for example if an exception is thrown inside Silverlight.
code: -100
message: Generic error.

HTTP transport error. For example if the server produces a HTTP status other than 200.
code: -200
message: HTTP Error.

Generic I/O error. For exampe if it wasn't possible to open the file stream on local machine.
code: -300
message: IO error.

Generic I/O error. For exampe if it wasn't possible to open the file stream on local machine.
code: -400
message: Security error.

Initialization error. Will be triggered if no runtime was initialized.
code: -500
message: Init error.

File size error. If the user selects a file that is to large it will be blocked and an error of this type will be triggered.
code: -600
message: File size error.

File extension error. If the user selects a file that isn't valid according to the filters setting.
code: -601
message: File extension error.
Runtime will try to detect if image is proper one. Otherwise will throw this error.
code: -700
While working on the image runtime will try to detect if the operation may potentially run out of memeory and will throw this error.
code: -701code: -200
Each runtime has an upper limit on a dimension of the image it can handle. If bigger, will throw this error.
code: -702

NOTE: the above is a list extracted from the source code of plupload, but I think there are some errors that are triggered when using some runtimes only, and even more, there are errors that are not triggered at all ! (for example IMAGE_FORMAT_ERROR)

Also, there are error events with more properties than just "code" and "message", for example, if we are using gears:

up.trigger('Error', {
                                    code : plupload.HTTP_ERROR,
                                    message : plupload.translate('HTTP Error.'),
                                    file : file,
                                    chunk : chunk,
                                    chunks : chunks,
                                    status : req.status

This is a bit confusing...

What are the chunks and how they work?
plupload can brean your files in "chunks", and send each chunk to the server in a different POST request.
This is useful when we are uploading big files that exceed the max_size limit for POST requests in our server.

Also check this post for more info and recommendations about chunks:

How to upload big files? (bigger than our server max file size)

Using the chunks is the only way one can bypass server-side "max file size" limitation. Although some shared hostings as it seems directly monitor file sizes in temp folders and drop the connection if they detect violation (for example Strato is known to behave like this).

What is the difference beween multipart and stream?

Multipart (multipart/form-data) upload is usual way to send files to server. This is what browsers use to submit forms with files. When Plupload is set to multipart mode (default), it will upload files the way one would expect (for PHP it will populate $_FILES array, etc). In non multipart mode, files are sent as binary streams and it's up to implementer to receive them properly (for PHP check: php:// — Accessing various I/O streams)

What happens if we bind events before calling init()?

In addition to the event listeners that one might bind to uploader object, there are also ones already defined, that Plupload uses internally. For example there is a listener for FilesAdded event, which does filtering of the files and if they pass it, adds them to the queue.

When you bind event listeners before the call to uploader.init(), they are binded before internal listeners and are executed accordingly. This is done for users to have ability to expand or override internal event handlers for whatever reason. If false is returned from the user defined event handler, which was binded to the event before the internal one, internal is not executed anymore.

When event handler is binded after the call to uploader.init(), all internal handlers run without intervention, intended or not. And unexpected results are simply excluded.

When do we need to use "up.refresh();"?

File dialog trigger is positioned absolutely above the browse_button element, so if Plupload html structure is not appended to the same parent (check container option) and browse_button element gets moved for some reason, one needs to call up.refresh(); to reposition file dialog trigger.

What is the difference between "UploadFile" and "BeforeUpload" events?

BeforeUpload is triggered before file is uploaded, while UploadFile triggers after upload is already started (for the latter to be true UploadFile should be binded after uploader.init()).

Why the upload continue even after calling stop?
Currently ( 04/2011 ) plupload is not able to cancel remaining chunks and will continue to upload them, until all of them are uploaded and then will stop. This will be fixed in next minor release. Major update, which is on schedule now, will make chunking feature much more convenient and stable.

3 (edited by enridp 2011-06-12 01:58:33)

Re: FAQs

WITHOUT REPLIES (or without checked answers)
Please help to answer them

How to obtain a reference to the uploader?
If you are using the UI widget, I think you can execute this:

var uploader = $('#uploader').plupload('getUploader');

And I think that for Queue Widget you must use this:

// note that pluploadQueue is called without parameters
var uploader = $('#uploader').pluploadQueue();

What is the max file size that we can upload?

When to use multipart and when to use stream?

Common problems and solutions?

How to re-enable the uploader after an error in Queue Widget?
I don't know if this is the best way, but at least is working, you can execute this for enabling the upload buttons again after an error:

    $(".plupload_buttons,.plupload_upload_status").css("display", "inline");

Best practices or recommendations?
(for example try to use Gears and SIlverlight before Flash if you need to resize or upload big images)

Re: FAQs

Nice initiative smile I've edited How to create the uploader? to How to get the reference to uploader object?, 'cause that's what it does.

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

5 (edited by enridp 2011-05-31 12:07:48)

Re: FAQs

Thanks for the edit davit.
I've changed the answer for the image size limit in Flash too.
And cleaned the thread.

In the second post I put the questions with answers, and in the third the qustions without answers to make it easy to read.

I will need help with this, I hope you and other users can help too.
I'm still learning plupload and some of my replies are vague (for example the list of errors)

Re: FAQs

Sure smile

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

7 (edited by enridp 2011-06-12 01:59:54)

Re: FAQs

I've added a tentaive reply to one of the questions without answers (3rd post).

How to obtain a reference to the uploader?

This is how you get uploader instance:

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

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

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

Can you complete it davit?


Re: FAQs

Updated your reply wink

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

Re: FAQs

These FAQ's are very helpful and useful guide to newbies, thanks! wink

Re: FAQs

FAQ are very useful

Re: FAQs

FAQ are really very helpful and useful for us. Really very nice post.

Re: FAQs

today i bought the $10 license but i do not know how to create the jQuery queue widget example, sorry i am new to this.

Re: FAQs

take a look on these address:


all these pages contains examples with the queue widget.


Re: FAQs

Can i make a little FAQ? do you want to have a 4G Signal Jammer? then come to have a look.

Re: FAQs

Very nice FAQ. It's come in very handy. I especially appreciate the error messages list.

I was wondering about this one:

Runtime will try to detect if image is proper one. Otherwise will throw this error.
code: -700

I may be way off here but to me this sounds like if the user tries to upload a jpg, that isn't a valid jpg, it will throw this error.

The way I was trying to test this was to rename a .html file to .jpg and tried to add it to the file list.
I got an error in moxie.min.js while debugging (t.ImageError.WRONG_FORMAT) but it didn't throw error 700 in plupload and the file was added to the queue regardless.
It may not suppose to work this way but it would be a very neat thing if it could be caught.

For example, if a filter is in place to only allow images, a savvy user could change the extension of his file to jpeg and still upload it, even though it wouldn't be a valid jpeg.

Re: FAQs

While you are right and we could trigger an error event with this code for various exceptions raised during image processing, we won't be able to detect if image is valid or not, unless we load it, which   is not exactly performance wise.

But I will bear in mind your suggestion for HTML5 only implementation, that I'm working on.

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