Ext.ux.UploadDialog (for ExtJS 1.1) demo page.
Usage example.
This is the code taken from upload-dialog.js.
dialog = new Ext.ux.UploadDialog.Dialog(null, {
autoCreate: true,
closable: true,
collapsible: false,
draggable: true,
minWidth: 400,
minHeight: 200,
width: 400,
height: 350,
proxyDrag: true,
resizable: true,
constraintoviewport: true,
title: 'File upload queue.',
url: '/dev/upload-dialog-request.php',
reset_on_hide: false,
allow_close_on_upload: true
});
...
dialog.show('show-button');
Configuration.
Most configuration options are inherited from BasicDialog (see ExtJs docs).
The added ones are:
- url - the url where to post uploaded files.
- base_params - additional post params (default to {}).
- permitted_extensions - array of file extensions which are permitted to upload (default to []).
- reset_on_hide - whether to reset upload queue on dialog hide or not (default true).
- allow_close_on_upload - whether to allow hide/close dialog during upload process (default false).
- upload_autostart - whether to start upload automaticaly when file added or not (default false).
Events.
-
filetest - fires before file is added into the queue, parameters:
dialog - reference to dialog
filename - file name
If handler returns false then file will not be queued.
-
fileadd - fires when file is added into the queue, parameters:
dialog - reference to dialog
filename - file name
-
fileremove - fires when file is removed from the queue, parameters:
dialog - reference to dialog
filename - file name
-
resetqueue - fires when upload queue is resetted, parameters:
dialog - reference to dialog
-
uploadsuccess - fires when file is successfuly uploaded, parameters:
dialog - reference to dialog
filename - uploaded file name
data - js-object builded from json-data returned from upload handler response.
-
uploaderror - fires when file upload error occured, parameters:
dialog - reference to dialog
filename - uploaded file name
data - js-object builded from json-data returned from upload handler response.
-
uploadfailed - fires when file upload failed, parameters:
dialog - reference to dialog
filename - failed file name
-
uploadstart - fires when upload process starts, parameters:
dialog - reference to dialog
-
uploadstop - fires when upload process stops, parameters:
dialog - reference to dialog
-
uploadcomplete - fires when upload process complete (no files to upload left), parameters:
dialog - reference to dialog
Public methods
Better go see the source.
I18n.
The class is ready for i18n, override the Ext.ux.UploadDialog.Dialog.prototype.i18n object with
your language strings, or just pass i18n object in config.
Server side handler.
The files in the queue are posted one at a time, the file field name is 'file'. The handler
should return json encoded object with following properties:
{
success: true|false, // required
error: 'Error or success message' // optional, also can be named 'message'
}
Download.
Ext.ux.UploadDialog.zip
Licence.
No warranties, use it on your own risk, respectoware :D
(if you like it and feels it's useful for you go to
ExtJS forum
find any of my posts (username MaximGB) and add to my reputation :)))))
Author.
Maxim Bazhenov (aka MaximGB)
Change history
-
13.08.2007
- initial release.
-
14.08.2007
- stopUpload() and abort action are now synchronous.
- uploadstopping event removed.
- allow_close_on_upload config parameter and respective getter/setter added.
- upload_autostart config parameter and respective getter/setter added.
- now user can add files during upload process.
-
16.08.2007
- Fixed: scrollbars shown in dialog body when aero theme applyed.
- Dialogs progress bar style changed from 100% to auto.
- Added ru.utf-8 locale.
-
17.08.2007
- Fixed division by zero bug in Ext.ux.ProgressBar component which UploadDialog depends on.
- Fixed wrong complete count bug. Processing file was counted as completed.
- Fixed upload/abort button state mishandling when upload_autostart option is enabled.
-
09.10.2007
- Fixed bug which makes IE to create new DOMElements with doubled class attribute, making dialog's css-rules invalid.
-
12.11.2007
- Fixed silly bug - mistyping in onAjaxFailure method, reported by dafimoto, cchiriac from ExtJS forums.