Professional Documents
Culture Documents
Readme
Readme
2 version)
by Stickman
http://the-stickman.com
with thanks to:
Luis Torrefranca -- http://www.law.pitt.edu
and
Shawn Parker & John Pennypacker -- http://www.fuzzycoconut.com
...for Safari fixes in the original version
Licence:
You may use this script as you wish without limitation, however I would
appreciate it if you left at least the credit and site link above in
place. I accept no liability for any problems or damage encountered
as a result of using this script.
Requires:
Mootools 1.2 [ http://mootools.net ]
...with at least:
Window.DomReady and its dependencies
Supports:
All browsers supported by Mootools (see Mootools site for details)
Usage:
See the included example.html for demonstration code.
Include this file (or the packed version) and your mootools.js release in
your HTML file. To convert a standard file input element into a multiple
file input element, add the following code to your HTML:
window.addEvent('domready', function(){
new MultiUpload( $( 'my_form' ).my_file_input_element );
});
Optional parameters:
There are four optional parameters (null = ignore this parameter):
Other notes
Because it's not possible to set the value of a file input element
dynamically (for good security reasons), this script works by hiding the
file input element when a file is selected, then immediately replacing
it with a new, empty one. This happens so quickly that it looks as if
there's only ever one file input element.
Although ideally the extra elements would be hidden using the CSS setting
'display:none', this causes Safari to ignore the element completely when
the form is submitted. So instead, elements are moved to a position
off-screen.
And no, it's not 'Ajax' -- it doesn't upload the files in the background or
anything clever like that. Its sole purpose is cosmetic: to remove the
need for multiple file input elements in a form.