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.6.0

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

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.util.AttributeProvider:

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

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 , headers )
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.
headers <Object> An object containing variables that should be set as headers in the POST request. The following header names cannot be used: Accept-Charset, Accept-Encoding, Accept-Ranges, Age, Allow, Allowed, Authorization, Charge-To, Connect, Connection, Content-Length, Content-Location, Content-Range, Cookie, Date, Delete, ETag, Expect, Get, Head, Host, Keep-Alive, Last-Modified, Location, Max-Forwards, Options, Post, Proxy-Authenticate, Proxy-Authorization, Proxy-Connection, Public, Put, Range, Referer, Request-Range, Retry-After, Server, TE, Trace, Trailer, Transfer-Encoding, Upgrade, URI, User-Agent, Vary, Via, Warning, WWW-Authenticate, x-flash-version.
Returns: void

uploadAll

void uploadAll ( uploadScriptPath , method , vars , fieldName , headers )
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.
headers <Object> An object containing variables that should be set as headers in the POST request. The following header names cannot be used: Accept-Charset, Accept-Encoding, Accept-Ranges, Age, Allow, Allowed, Authorization, Charge-To, Connect, Connection, Content-Length, Content-Location, Content-Range, Cookie, Date, Delete, ETag, Expect, Get, Head, Host, Keep-Alive, Last-Modified, Location, Max-Forwards, Options, Post, Proxy-Authenticate, Proxy-Authorization, Proxy-Connection, Public, Put, Range, Referer, Request-Range, Retry-After, Server, TE, Trace, Trailer, Transfer-Encoding, Upgrade, URI, User-Agent, Vary, Via, Warning, WWW-Authenticate, x-flash-version.
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

rollOut

rollOut ( event.type )
Fires when an upload of a specific file has started.
Parameters:
event.type <String> The event type

rollOver

rollOver ( event.type )
Fires when an upload of a specific file has started.
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 )
Fires when an upload of a specific file has started.
Parameters:
event.type <String> The event type

Configuration attributes inherited from YAHOO.widget.FlashAdapter:


Copyright © 2008 Yahoo! Inc. All rights reserved.