A file upload control that supports uploading multiple files, uploading inline (without reloading the page), and displaying upload progress on supported browser (Chrome, FF, Safari).
<form action="upload.php" method="post">
<input type="file" name="file" class="upload" />
To create upload controls out of all elements that match a given CSS rule:
|selector||yes||A CSS rule matching the text inputs to turn into color pickers|
An object (hash) containing name/value pairs of additional options.
Displaying upload progress in inline mode requires passing the data to the server in a different format than usual. Rather than encoding the file data as multipart/form-data, the upload control sets a "Content-Disposition" header, and passes the file data as the POST body. Since not all browsers support this, if you want to display file upload progress on supported browsers (the default in "inline" mode), you will need to support both upload methods in your server's upload handler.
In your upload handler, simply check for a "Content-Disposition" header. If it exists, the POST body contains the file data, and the file name can be retrieved from the header. If it does not exist, the file was uploaded in "multipart/form-data" encoding and can be processed like any other file upload.
To avoid this complication, you can also simply set the progress option to false, and files will always be submitted using multipart/form-data encoding.
In your <head> section:
To create an upload control:
var upload = new Control.FileUpload(element[, options]);
To destroy the upload control:
For more details, see the API documentation for Control.FileUpload.