Dojo Multifile Uploader with Flash
Date : 2008 09 04 Category : Tech & DevelopmentSitePen continues their work on Deft with a multi-file uploader:
The Dojo Toolkit now has support for multi-file uploads, thanks to the new Deft project. The dojox.form.FileUploader class embeds a hidden SWF file in the page which, when triggered, will open a system dialog that supports multiple file selection, and also file masks, which allows the user to filter their selection by file type.
Better yet, it’s fully degradable. If the user does not have version 9 or greater of the Flash Player installed it can, depending on the options you set, present the user with a standard HTML file input instead (or the option to install the latest Flash Player). The HTML form also supports multiple files, although due to browser restrictions, only one can be selected at a time. But they are all uploaded at once.
A major benefit to developers is the flexibility to supply your own styled upload button. For example, a paperclip icon toolbar button in an email application should not look like the standard file input with a text field followed by a “browse …” button. What inspired this design was working on projects where designers and clients would hand me a specification which would say, “the upload button looks like this“.
To use it? Fairly simple:
PLAIN TEXT JAVASCRIPT: var uploader = new dojox.form.FileInputFlash({ uploadUrl:"http.localHost/FileUpload.php", button:myButton, uploadOnChange: false, selectMultipleFiles: true, fileMask: ["All Images", "*.jpg;*.jpeg;*.gif;*.png"], degradable: true });This comes after the YouTube uploader that uses Gears.
