YUI recommends YUI 3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

Yahoo! UI Library

Uploader  2.7.0

Yahoo! UI Library > uploader > YAHOO.widget.Uploader
Search:
 
Filters

Class YAHOO.widget.Uploader - uses YAHOO.widget.FlashAdapter

Uploader class for the YUI Uploader component.

Constructor

YAHOO.widget.Uploader ( containerId , buttonSkin , forceTransparent )
Parameters:
containerId <HTMLElement> Container element for the Flash Player instance.
buttonSkin <String> [optional]. If defined, the uploader is rendered as a button. This parameter must provide the URL of a button skin sprite image. Acceptable types are: jpg, gif, png and swf. The sprite is divided evenly into four sections along its height (e.g., if the sprite is 200 px tall, it's divided into four sections 50px each). Each section is used as a skin for a specific state of the button: top section is "up", second section is "over", third section is "down", and fourth section is "disabled". If the parameter is not supplied, the uploader is rendered transparent, and it's the developer's responsibility to create a visible UI below it.
forceTransparent <Boolean> This parameter, if true, forces the Flash UI to be rendered with wmode set to "transparent". This behavior is useful in conjunction with non-rectangular button skins with PNG transparency. The parameter is false by default, and ignored if no buttonSkin is defined.

Properties

Chart.SWFURL - private static final object

Location of the Uploader SWF
Default Value: "assets/uploader.swf"

Methods

cancel

void cancel ( fileID )
Cancels the upload of a specified file. If no file id is specified, all ongoing uploads are cancelled.
Parameters:
fileID <String> The ID of the file whose upload should be cancelled.
Returns: void

clearFileList

void clearFileList ( )
Clears the list of files queued for upload.
Returns: void

disable

void disable ( )
Disables the mouse events on the Uploader. If the uploader is being rendered as a button, then the button's skin is set to "disabled" (fourth section of the button skin sprite).
Returns: void

enable

void enable ( )
Enables the mouse events on the Uploader. If the uploader is being rendered as a button, then the button's skin is set to "up" (first section of the button skin sprite).
Returns: void

removeFile

void removeFile ( fileID )
Removes the specified file from the upload queue.
Parameters:
fileID <String> The id of the file to remove from the upload queue.
Returns: void

setAllowLogging

void setAllowLogging ( allowLogging )
Turns the logging functionality on. Uses Flash internal trace logging, as well as YUI Logger, if available.
Parameters:
allowLogging <Boolean> If true, logs are output; otherwise, no logs are produced.
Returns: void

setAllowMultipleFiles

void setAllowMultipleFiles ( allowMultipleFiles )
Sets the flag allowing users to select multiple files for the upload.
Parameters:
allowMultipleFiles <Boolean> If true, multiple files can be selected. False by default.
Returns: void

setFileFilters

void setFileFilters ( newFilterArray )
Sets the file filters for the "Browse" dialog.
Parameters:
newFilterArray <extensions: extensionString, description: descriptionString, [optional]macType: macTypeString> An array of sets of key-value pairs of the form The extensions string is a semicolon-delimited list of elements of the form "*.xxx", e.g. "*.jpg;*.gif;*.png".
Returns: void

setSimUploadLimit

void setSimUploadLimit ( simUploadLimit )
Sets the number of simultaneous uploads when using uploadAll() The minimum value is 1, and maximum value is 5. The default value is 2.
Parameters:
simUploadLimit <int> Number of simultaneous uploads, between 1 and 5.
Returns: void

upload

void upload ( fileID , uploadScriptPath , method , vars , fieldName )
Starts the upload of the file specified by fileID to the location specified by uploadScriptPath.
Parameters:
fileID <String> The id of the file to start uploading.
uploadScriptPath <String> The URL of the upload location.
method <String> Either "GET" or "POST", specifying how the variables accompanying the file upload POST request should be submitted. "GET" by default.
vars <Object> The object containing variables to be sent in the same request as the file upload.
fieldName <String> The name of the variable in the POST request containing the file data. "Filedata" by default.
Returns: void

uploadAll

void uploadAll ( uploadScriptPath , method , vars , fieldName )
Starts uploading all files in the queue. If this function is called, the upload queue is automatically managed.
Parameters:
uploadScriptPath <String> The URL of the upload location.
method <String> Either "GET" or "POST", specifying how the variables accompanying the file upload POST request should be submitted. "GET" by default.
vars <Object> The object containing variables to be sent in the same request as the file upload.
fieldName <String> The name of the variable in the POST request containing the file data. "Filedata" by default.
Returns: void

Events

click

click ( event.type )
Fires when the uploader is clicked.
Parameters:
event.type <String> The event type

fileSelect

fileSelect ( event.type , event.fileList , event.fileList[].size , event.fileList[].cDate , event.fileList[].mDate , event.fileList[].name , event.fileList[].id )
Fires when the user has finished selecting files in the "Open File" dialog.
Parameters:
event.type <String> The event type
event.fileList <Object> A dictionary of objects with file information
event.fileList[].size <Number> File size in bytes for a specific file in fileList
event.fileList[].cDate <Date> Creation date for a specific file in fileList
event.fileList[].mDate <Date> Modification date for a specific file in fileList
event.fileList[].name <String> File name for a specific file in fileList
event.fileList[].id <String> Unique file id of a specific file in fileList

mouseDown

mouseDown ( event.type )
Fires when the mouse is pressed over the Uploader. Only fires when the Uploader UI is enabled and the render type is 'transparent'.
Parameters:
event.type <String> The event type

mouseUp

mouseUp ( event.type )
Fires when the mouse is released over the Uploader. Only fires when the Uploader UI is enabled and the render type is 'transparent'.
Parameters:
event.type <String> The event type

rollOut

rollOut ( event.type )
Fires when the mouse rolls out of the Uploader.
Parameters:
event.type <String> The event type

rollOver

rollOver ( event.type )
Fires when the mouse rolls over the Uploader.
Parameters:
event.type <String> The event type

uploadCancel

uploadCancel ( event.type , event.id )
Fires when an upload for a specific file is cancelled.
Parameters:
event.type <String> The event type
event.id <String> The id of the file with which the upload has been cancelled.

uploadComplete

uploadComplete ( event.type , event.id )
Fires when an upload for a specific file is complete.
Parameters:
event.type <String> The event type
event.id <String> The id of the file for which the upload has been completed.

uploadCompleteData

uploadCompleteData ( event.type , event.id , event.data )
Fires when the server sends data in response to a completed upload.
Parameters:
event.type <String> The event type
event.id <String> The id of the file for which the upload has been completed.
event.data <String> The raw data returned by the server in response to the upload.

uploadError

uploadError ( event.type , event.id , event.status )
Fires when an upload error occurs.
Parameters:
event.type <String> The event type
event.id <String> The id of the file that was being uploaded when the error has occurred.
event.status <String> The status message associated with the error.

uploadProgress

uploadProgress ( event.type , event.id , bytesLoaded , bytesTotal )
Fires when new information about the upload progress for a specific file is available.
Parameters:
event.type <String> The event type
event.id <String> The id of the file with which the upload progress data is associated
bytesLoaded <Number> The number of bytes of the file uploaded so far
bytesTotal <Number> The total size of the file

uploadStart

uploadStart ( event.type , event.id )
Fires when an upload of a specific file has started.
Parameters:
event.type <String> The event type
event.id <String> The id of the file that's started to upload

Configuration attributes inherited from YAHOO.widget.FlashAdapter:


Copyright © 2009 Yahoo! Inc. All rights reserved.