mootools ajax file upload with:
- file drag drop support (currently supported by chrome5+ and firefox 3.6+)
- no iframe and progress bar for browser that support HTML5 File API (chrome5+, safari4+, Firefox 3.6+)
- iframe for the other
see the Demo folder. you will need a webserver with php installed to run the demo.
object providing methods to control field upload.
(boolean) indicates if the browser handle file dragdrop.
(boolean) indicates if the browser handle XMLHTTPRequest file upload.
create a new upload field.
- (object) - file upload instance.
- options - (object) see file upload instance options.
see file upload instance options.
- container - (string) upload field container id.
- base - (string, optional) url of the page that will handle server side file upload. default to upload.php.
- limit - (int, optional) maximum number of file the user should upload. 0 means no limit. default to 0.
- multiple - (boolean, optional) enable multiple file selection for the input if the browser can handle it.
- filetype - (string, optional) authorized file type.
- name - (string) name of the upload form field. it contains the original name of the file sent by the user. if the upload succeed a hidden field named 'file_' + name and containing the encrypted file path on the server will be pushed into the form. for example if our form field is named name[], then name[] will contains the original file name and file_name[] will contains the encrypted file path on the server.
Fired after the uplaod instance has been created.
- id - (object) upload transfer instance id.
Fired before the file is uploaded.
- options - (object)
- element - (element) the upload field instance container.
- file - (string) the file name.
- size - (int) file size. if the browser supports XMLHTTPRequest file upload, this will be the actual file size, otherwise it will be 0.
Fired when the transfer is aborted (it has not started).
- file - (string) file name
- message - (string) error message
- element - (element) the upload field instance container.
- file - (string) the file name.
- size - (int) file size. if the browser supports XMLHTTPRequest file upload, this wil be the actual file size, otherwise it will be 0.
Fired when the transfer is cancelled.
- transfer - (object) file upload instance.
Fired when the transfer fails.
- transfer - (object) file upload instance.
Fired when the transfer succeed.
- infos - (object) uploaded file infos
- file - (string) the original file name.
- path - (string) the encrypted file path on the server.
- size - (int) uploaded file size.
- transfer - (object) file upload instance which fired the event
Fired when the transfer is complete.
- transfer - (object) upload file instance
- element - (element) the upload field instance container.
- file - (string) the file name.
- size - (int) file size. if the browser supports XMLHTTPRequest file upload, this wil be the actual file size, otherwise it will be 0.
attach file dragdrop events to an element if the browser supports it.
- (object) - uploadManager.
- el - (mixed) element
- options - (object) see file .
remove file dragdrop events on an element.
- (object) - uploadManager.
- el - (mixed) element
return the file upload instance options with a given id.
- (object) - .
- el - (mixed) element
format file size for reading.
- (string)
- size - (int) element
return uploaded file size for a given container.
- (int)
- container - (string) container id
object wrapping a file upload instance.
Options, Events. see uploadManager#upload for implemented options and events.