Yahoo! UI Library

Uploader  2.5.0

Yahoo! UI Library > uploader > YAHOO.widget.Uploader

Show Private Show Protected

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

Uploader class for the YUI Uploader component.

Constructor

YAHOO.widget.Uploader ( containerId )
Parameters:
containerId <HTMLElement> Container element for the Flash Player instance.

Properties

Chart.SWFURL - private static final object

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

Properties inherited from YAHOO.widget.FlashAdapter:

Properties inherited from YAHOO.util.AttributeProvider:

Methods

browse

void browse ( allowMultiple , extensionFilterArray )
Invokes the "Open File" dialog and allows the user to select the files for upload
Parameters:
allowMultiple <Boolean> If true, allows for multiple file selection; if false, only a single file can be selected. False by default.
extensionFilterArray <Array} An array of key-value pairs for permissible file extensions. The array elements should be of the form: {description: "Images", extensions: "*.jpg, *.gif, *.png"> .
Returns: void

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

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

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

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 <Array> An array 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

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 © 2007 Yahoo! Inc. All rights reserved.