Configuration
Each plupload instance has a set of config options. Here is a short description about each available option.
General options
Here is a list of options that are available in the core API. Some of them are runtime specific. Checkout the custom example to see these option used live.
- runtimes
- This is a comma separated list of runtimes that you want to initialize the uploader instance with. It will try to initialize each runtime in order if one fails it will move on to the next one.
- url
- Page URL to where the files will be uploaded to.
- max_file_size
- Maximum file size that the user can pick. This string can be in the following formats 100b, 10kb, 10mb.
- chunk_size
- Enables you to chunk the file into smaller pieces for example if your PHP backend has a max post size of 1MB you can chunk a 10MB file into 10 requests. To disable chunking, remove this config option from your setup.
- unique_names
- Generate unique filenames when uploading. This will generate unqiue filenames for the files so that they don't for example collide with existing ones on the server.
- resize
- Enables plupload to resize the images to clientside to the specified width, height and quality. Set this to an object with those parameters.
- filters
- List of filters to apply when the user selects files. This is currently file extension filters there are two items for each filter. title and extensions.
- flash_swf_url
- URL to where the SWF file is for the Flash runtime.
- silverlight_xap_url
- URL to where the XAP file is for the Silverlight runtime.
- browse_button
- String with the ID of the browse button. Flash, HTML 5 and Silverlight requires a shim so you need to specify the id of the button that the shim will be placed above for those runtimes. This option is not required for by the queue widget.
- drop_element
- String with the ID of the element that you want to be able to drop files into this is only used by some runtimes that support it.
- container
- Element ID to add object elements to, this defaults to the document body element.
- multipart
- Boolean state if the files should be uploaded using mutlipart instead of direct binary streams. Doesn't work on WebKit using the HTML 5 runtime.
- multipart_params
- Object name/value collection with arguments to get posted together with the multipart file.
- required_features
- Comma separated list of features that each runtime must have for it to initialize.
- headers
- Name/value object with custom headers to add to HTTP requests.
Queue widget specific options
Here is a list of options that is specific to the jQuery queue widget.
- preinit
- Function callback that enables you to bind events before the uploader is initialized.
- dragdrop
- Boolean state if the drag/drop support for all runtimes should be enabled or disabled. Default is true.
- rename
- Boolean state if it should be possible to rename files before uploading them. Default is false.
Example of the various config options
var uploader = new plupload.Uploader({
runtimes : 'gears,html5,flash,silverlight,browserplus',
browse_button : 'pickfiles',
max_file_size : '10mb',
resize : {width : 320, height : 240, quality : 90},
url : 'upload.php',
flash_swf_url : '/plupload/js/plupload.flash.swf',
silverlight_xap_url : '/plupload/js/plupload.silverlight.xap',
filters : [
{title : "Image files", extensions : "jpg,gif,png"},
{title : "Zip files", extensions : "zip"}
]
});