Where is a quick tutorial?
http://www.plupload.com/punbb/viewtopic.php?id=787
How to get the reference to uploader object?
// in Core API
var uploader = new plupload.Uploader({
...object with options here
});
// for Queue widget
$("#uploader").pluploadQueue({
...object with options here
});
var uploader = $("#uploader").pluploadQueue(); // notice blank parenthesis
// for UI widget
$("#uploader").plupload({
...object with options here
});
var uploader = $("#uploader").plupload('getUploader');
you can learn more about the options accepted by plupload here:
http://www.plupload.com/documentation.php#configuration
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:
8191x8191px
you can read more here:
http://www.plupload.com/punbb/viewtopic.php?id=602
How to translate the widgets?
Just add something like this:
plupload.addI18n({
'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:
http://github.com/moxiecode/plupload
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:
"FileUploaded"
"ChunkUploaded"
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) {
alert(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
message:
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
message:
message:
Each runtime has an upper limit on a dimension of the image it can handle. If bigger, will throw this error.
code: -702
message:
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:
http://www.plupload.com/punbb/viewtopic.php?id=840
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.