Yahoo! UI Library

Uploader  3.2.0

Yahoo! UI Library > uploader > Uploader
Search:
 
Filters

Class Uploader - extends Y.Base

Creates the Uploader instance and keeps the initialization data

Constructor

Uploader ( config )
Parameters:
config <Object> (optional) Configuration parameters for the Uploader. The following parameters are available:
boundingBox : String|Node (required)
buttonSkin : String (optional)
transparent : String (optional)
swfURL : String (optional)

Properties

_id - private {String}

The id of this instance of uploader.

uploaderswf - private {SWF}

The reference to the instance of Y.SWF that encapsulates the instance of the Flash player with uploader logic.
Default Value: null

Methods

_initializeUploader

private void _initializeUploader ( event )
Called when the uploader SWF is initialized
Parameters:
event <Object> The event to be propagated from Flash.

_relayEvent

private void _relayEvent ( event )
Called when an event is dispatched from Uploader
Parameters:
event <Object> The event to be propagated from Flash.

cancel

void cancel ( fileID )
Cancels the upload of a specific file, if currently in progress.
Parameters:
fileID <String> (optional) The ID of the file whose upload should be cancelled. If no ID is specified, all uploads are cancelled.

clearFileList

Boolean clearFileList ( )
Clears the upload queue.
Returns: Boolean
This method always returns true.

enable

void enable ( )
Enables the uploader user input (mouse clicks on the 'Browse' button). If the button skin is applied, the sprite is reset from the "disabled" state.

initializer

protected void initializer ( )
Construction logic executed during Uploader instantiation.

removeFile

Object} The updated file list, which is an object of the format: fileList[fileID] = {id: fileID, name: fileName, cDate: fileCDate, mDate: fileMDate, size: fileSize removeFile ( fileID )
Removes a specific file from the upload queue.
Parameters:
fileID <String> The ID of the file to be removed

setAllowLogging

private void setAllowLogging ( value )
Setter for the 'log' property.
Parameters:
value <Boolean> The value for the 'log' property.

setAllowMultipleFiles

private void setAllowMultipleFiles ( value )
Setter for the 'multiFiles' property.
Parameters:
value <Boolean> The value for the 'multiFiles' property.

setFileFilters

private void setFileFilters ( value )
Setter for the 'fileFilters' property.
Parameters:
value <Boolean> The value for the 'fileFilters' property.

setSimUploadLimit

private void setSimUploadLimit ( value )
Setter for the 'simLimit' property.
Parameters:
value <Boolean> The value for the 'simLimit' property.

upload

Boolean upload ( fileID , url , method , postVars , postFileVarName )
Starts the upload of a specific file.
Parameters:
fileID <String> The ID of the file to be uploaded.
url <String> The URL to upload the file to.
method <String> (optional) The HTTP method to use for sending additional variables, either 'GET' or 'POST' ('GET' by default)
postVars <Object> (optional) A set of key-value pairs to send as variables along with the file upload HTTP request.
postFileVarName <String> (optional) The name of the POST variable that should contain the uploaded file ('Filedata' by default)
Returns: Boolean
This method always returns true.

uploadAll

void uploadAll ( url , method , postVars , postFileVarName )
Starts the upload of the files in the upload queue. The upload queue is managed automatically.
Parameters:
url <String> The URL to upload the files to.
method <String> (optional) The HTTP method to use for sending additional variables, either 'GET' or 'POST' ('GET' by default)
postVars <Object> (optional) A set of key-value pairs to send as variables along with the file upload HTTP request.
postFileVarName <String> (optional) The name of the POST variable that should contain the uploaded file ('Filedata' by default).

uploadThese

void uploadThese ( fileIDs , url , method , postVars , postFileVarName )
Starts the upload of a set of files, as specified in the first argument. The upload queue is managed automatically.
Parameters:
fileIDs <Array> The array of IDs of the files to be uploaded.
url <String> The URL to upload the files to.
method <String> (optional) The HTTP method to use for sending additional variables, either 'GET' or 'POST' ('GET' by default)
postVars <Object> (optional) A set of key-value pairs to send as variables along with the file upload HTTP request.
postFileVarName <String> (optional) The name of the POST variable that should contain the uploaded file ('Filedata' by default)

Events

boundingBoxChange

boundingBoxChange ( event )
Fires when the value for the configuration attribute 'boundingBox' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event <Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

buttonSkinChange

buttonSkinChange ( event )
Fires when the value for the configuration attribute 'buttonSkin' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event <Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

click

click ( event )
Fired when the mouse button is clicked on the Uploader's 'Browse' button.
Parameters:
event <Event> The event object for the click.

fileFiltersChange

fileFiltersChange ( event )
Fires when the value for the configuration attribute 'fileFilters' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event <Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

fileselect

fileselect ( event )
Fires when the user has finished selecting a set of files to be uploaded.
Parameters:
event <Event} The event object for the fileSelect.
fileList
The file list Object with entries in the following format: fileList[fileID] = {id: fileID, name: fileName, cDate: fileCDate, mDate: fileMDate, size: fileSize>

logChange

logChange ( event )
Fires when the value for the configuration attribute 'log' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event <Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

mousedown

mousedown ( event )
Fired when the mouse button is pressed on the Uploader's 'Browse' button.
Parameters:
event <Event> The event object for the mousedown.

mouseenter

mouseenter ( event )
Fired when the mouse enters the Uploader's 'Browse' button.
Parameters:
event <Event> The event object for the mouseenter.

mouseleave

mouseleave ( event )
Fired when the mouse leaves the Uploader's 'Browse' button.
Parameters:
event <Event> The event object for the mouseleave.

mouseup

mouseup ( event )
Fired when the mouse button is raised on the Uploader's 'Browse' button.
Parameters:
event <Event> The event object for the mouseup.

multiFilesChange

multiFilesChange ( event )
Fires when the value for the configuration attribute 'multiFiles' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event <Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

simLimitChange

simLimitChange ( event )
Fires when the value for the configuration attribute 'simLimit' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event <Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

swfURLChange

swfURLChange ( event )
Fires when the value for the configuration attribute 'swfURL' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event <Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

transparentChange

transparentChange ( event )
Fires when the value for the configuration attribute 'transparent' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event <Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

uploadcancel

uploadcancel ( event )
Announces that the uploader is ready and available for calling methods and setting properties
Parameters:
event <Event> The event object for the uploaderReady.
ddEvent
drag:start event from the thumb

uploadcomplete

uploadcomplete ( event )
Fires when a specific file's upload is cancelled.
Parameters:
event <Event> The event object for the uploadcancel.
id
The id of the file whose upload has been cancelled.

uploadcompletedata

uploadcompletedata ( event )
If the server has sent a response to the file upload, this event is fired and the response is added to its payload.
Parameters:
event <Event> The event object for the uploadcompletedata.
id
The id of the file for which the response is being provided.
data
The content of the server response.

uploaderReady

uploaderReady ( event )
Announces that the uploader is ready and available for calling methods and setting properties
Parameters:
event <Event> The event object for the uploaderReady.

uploaderror

uploaderror ( event )
Provides error information if an error has occurred during the upload.
Parameters:
event <Event> The event object for the uploadeerror.
id
The id of the file for which the upload error has occurred.
status
Relevant error information.

uploadprogress

uploadprogress ( event )
Provides progress information on a specific file upload.
Parameters:
event <Event> The event object for the uploadprogress.
id
The id of the file for which the progress information is being provided.
bytesLoaded
The number of bytes of the file that has been uploaded.
bytesTotal
The total number of bytes in the file that is being uploaded.

uploadstart

uploadstart ( event )
Announces that the upload has been started for a specific file.
Parameters:
event <Event> The event object for the uploadstart.
id
The id of the file whose upload has been started.

Configuration Attributes

boundingBox - writeonce {Node}

The Node containing the uploader's 'Browse' button.
Default Value: null

buttonSkin - writeonce {String}

The URL of the image sprite for skinning the uploader's 'Browse' button.
Default Value: null

fileFilters - {Array}

The array of filters on file extensions for the 'Browse' dialog. These filters only provide convenience for the user and do not strictly limit the selection to certain file extensions. Each item in the array must contain a 'description' property, and an 'extensions' property that must be in the form "*.ext;*.ext;*.ext;..."
Default Value: []

log - {Boolean}

The flag that allows Flash player to output debug messages to its trace stack (if the Flash debug player is used).
Default Value: false

multiFiles - {Boolean}

The flag that allows the user to select more than one files during the 'Browse' dialog (using 'Shift' or 'Ctrl' keys).
Default Value: false

simLimit - {Number}

The number of files that can be uploaded simultaneously if the automatic queue management is used. This value can be in the range between 2 and 5.
Default Value: 2

swfURL - writeonce {String}

The URL of the uploader's SWF.
Default Value: "assets/uploader.swf"

transparent - writeonce {Boolean}

The flag indicating whether the uploader is rendered with a transparent background.
Default Value: true


Copyright © 2010 Yahoo! Inc. All rights reserved.