| Namespace | plupload |
| Class | Uploader |
var uploader = new plupload.Uploader({
runtimes : 'gears,html5,flash',
browse_button : 'button_id'
});
uploader.bind('Init', function(up) {
alert('Supports drag/drop: ' + (!!up.features.dragdrop));
});
uploader.bind('FilesAdded', function(up, files) {
alert('Selected files: ' + files.length);
});
uploader.bind('QueueChanged', function(up) {
alert('Queued files: ' + uploader.files.length);
});
uploader.init();
| Property | Defined By |
|---|---|
|
features : Object
Map of features that are available for the uploader runtime.
|
Uploader |
|
files : Array
Current upload queue, an array of File instances.
|
Uploader |
|
id : String
Unique id for the Uploader instance.
|
Uploader |
|
runtime : String
Current runtime name.
|
Uploader |
|
settings : Object
Object with name/value settings.
|
Uploader |
|
state : Number
Current state of the total uploading progress.
|
Uploader |
|
Total progess information.
|
Uploader |
| Method | Defined By |
|---|---|
|
Uploader(settings:Object)
Constructs a new uploader instance.
|
Uploader |
|
bind(name:String, func:function, scope:Object):void
Adds an event listener by name.
|
Uploader |
|
destroy():void
Destroys Plupload instance and cleans after itself.
|
Uploader |
|
Returns the specified file object by id.
|
Uploader |
|
init():void
Initializes the Uploader instance and adds internal event listeners.
|
Uploader |
|
refresh():void
Refreshes the upload instance by dispatching out a refresh event to all runtimes.
|
Uploader |
|
removeFile(file:File):void
Removes a specific file.
|
Uploader |
|
splice(start:Number, length:Number):Array
Removes part of the queue and returns the files removed.
|
Uploader |
|
start():void
Starts uploading the queued files.
|
Uploader |
|
stop():void
Stops the upload of the queued files.
|
Uploader |
|
trigger(name:String, Multiple:Object..):void
Dispatches the specified event name and it's arguments to all listeners.
|
Uploader |
|
unbind(name:String, func:function):void
Removes the specified event listener.
|
Uploader |
|
unbindAll():void
Removes all event listeners.
|
Uploader |
| Event | Defined By |
|---|---|
|
Fires when just before a file is uploaded.
|
Uploader |
|
Fires when file chunk is uploaded.
|
Uploader |
|
Fires when destroy method is called.
|
Uploader |
|
Fires when a error occurs.
|
Uploader |
|
FilesAdded(uploader:Uploader, files:Array)
Fires while when the user selects files to upload.
|
Uploader |
|
FilesRemoved(uploader:Uploader, files:Array)
Fires while a file was removed from queue.
|
Uploader |
|
Fires when a file is successfully uploaded.
|
Uploader |
|
Fires when the current RunTime has been initialized.
|
Uploader |
|
Fires after the init event incase you need to perform actions there.
|
Uploader |
|
QueueChanged(uploader:Uploader)
Fires when the file queue is changed.
|
Uploader |
|
Fires when the silverlight/flash or other shim needs to move.
|
Uploader |
|
StateChanged(uploader:Uploader)
Fires when the overall state is being changed for the upload queue.
|
Uploader |
|
UploadComplete(uploader:Uploader, files:Array)
Fires when all files in a queue are uploaded.
|
Uploader |
|
Fires when a file is to be uploaded by the runtime.
|
Uploader |
|
Fires while a file is being uploaded.
|
Uploader |
public features : Object
public id : String
public runtime : String
public settings : Object
public state : Number
public total : QueueProgress
public
function Uploader(settings:Object)
| settings:Object | Initialization settings, to be used by the uploader instance and runtimes. |
public
function bind(name:String, func:function, scope:Object):void
| name:String | Event name to listen for. |
| func:function | Function to call ones the event gets fired. |
| scope:Object | Optional scope to execute the specified function in. |
public
function destroy():void
public
function getFile(id:String):File
| id:String | File id to look for. |
public
function init():void
public
function refresh():void
public
function removeFile(file:File):void
| file:File | File to remove from queue. |
public
function splice(start:Number, length:Number):Array
| start:Number | (Optional) Start index to remove from. |
| length:Number | (Optional) Lengh of items to remove. |
public
function start():void
public
function stop():void
public
function trigger(name:String, Multiple:Object..):void
| name:String | Event name to fire. |
| Multiple:Object.. | arguments to pass along to the listener functions. |
public
function unbind(name:String, func:function):void
| name:String | Name of event to remove. |
| func:function | Function to remove from listener. |
public
function unbindAll():void
public
event BeforeUpload(uploader:Uploader, file:File)
| uploader:Uploader | Uploader instance sending the event. |
| file:File | File to be uploaded. |
public
event ChunkUploaded(uploader:Uploader, file:File, response:Object)
| uploader:Uploader | Uploader instance sending the event. |
| file:File | File that the chunk was uploaded for. |
| response:Object | Object with response properties. |
public
event Destroy(uploader:Uploader)
| uploader:Uploader | Uploader instance sending the event. |
public
event Error(uploader:Uploader, error:Object)
| uploader:Uploader | Uploader instance sending the event. |
| error:Object | Contains code, message and sometimes file and other details. |
public
event FilesAdded(uploader:Uploader, files:Array)
| uploader:Uploader | Uploader instance sending the event. |
| files:Array | Array of file objects that was added to queue/selected by the user. |
public
event FilesRemoved(uploader:Uploader, files:Array)
| uploader:Uploader | Uploader instance sending the event. |
| files:Array | Array of files that got removed. |
public
event FileUploaded(uploader:Uploader, file:File, response:Object)
| uploader:Uploader | Uploader instance sending the event. |
| file:File | File that was uploaded. |
| response:Object | Object with response properties. |
public
event Init(uploader:Uploader)
| uploader:Uploader | Uploader instance sending the event. |
public
event PostInit(uploader:Uploader)
| uploader:Uploader | Uploader instance sending the event. |
public
event QueueChanged(uploader:Uploader)
| uploader:Uploader | Uploader instance sending the event. |
public
event Refresh(uploader:Uploader)
| uploader:Uploader | Uploader instance sending the event. |
public
event StateChanged(uploader:Uploader)
| uploader:Uploader | Uploader instance sending the event. |
public
event UploadComplete(uploader:Uploader, files:Array)
| uploader:Uploader | Uploader instance sending the event. |
| files:Array | Array of file objects that was added to queue/selected by the user. |