YUI AS Component Documentation | All Packages | All Classes | Index | Frames No Frames |
Class Uploader

Package | Top Level
Class | public class Uploader
Inheritance | Uploader YUIAdapter flash.display.Sprite

The base Uploader class for YUI's Flash-based file uploader.

Public Properties

| Property | Defined by
--- | --- | ---
|  | simultaneousUploadLimit : Number = 2 Determines how many files will be uploaded simultaneously | Uploader

Protected Properties
Hide Inherited Protected Properties
Show Inherited Protected Properties

| Property | Defined by
--- | --- | ---
|  | elementID : String The element id that references the SWF in the HTML. | YUIAdapter
|  | javaScriptEventHandler : String The globally accessible JavaScript function that accepts events through ExternalInterface. | YUIAdapter

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined by
--- | --- | ---
|  | Uploader() | Uploader
|  | cancel(fileID:String = null):void Cancels either an upload of the file corresponding to a given fileID, or in the absence of the specified fileID, all active files being uploaded. | Uploader
|  | clearFileList():Boolean Clears the set of files that had been selected for upload | Uploader
|  | disable():void | Uploader
|  | enable():void | Uploader
|  | getAltText():String Gets the alternative text for assistive technology. | YUIAdapter
|  | removeFile(fileID:String):Object Removes the file from the set to be uploaded | Uploader
|  | setAllowLogging(allowLogging:Boolean):void Sets a flag allowing logging in Flash trace and Yahoo logger. | Uploader
|  | setAllowMultipleFiles(allowMultipleFiles:Boolean):void Sets a flag allowing multiple file selection in the "Browse" dialog. | Uploader
|  | setAltText(value:String):void Sets the alternative text for assistive technology. | YUIAdapter
|  | setFileFilters(newFilterArray:Array):void Sets a list of file type filters for the "Open File(s)" dialog. | Uploader
|  | setSimUploadLimit(simUploadLimit:int):void Sets the number of simultaneous file uploads possible. | Uploader
|  | upload(fileID:String, url:String, method:String = "GET", vars:Object = null, fieldName:String = "Filedata"):void Uploads a file corresponding to a specified ID to a specified path where a script handles writing to the server. | Uploader
|  | uploadAll(url:String, method:String = "GET", vars:Object = null, fieldName:String = "Filedata", headers:Object = null):void Uploads all files to a specified path where a script handles writing to the server. | Uploader
|  | uploadThese(fileIDs:Array, url:String, method:String = "GET", vars:Object = null, fieldName:String = "Filedata"):void Uploads the specified files to a specified path where a script handles writing to the server. | Uploader

Protected Methods
Hide Inherited Protected Methods
Show Inherited Protected Methods

| Method | Defined by
--- | --- | ---
|  | initializeComponent():void To be overridden by subclasses to add ExternalInterface callbacks. | YUIAdapter
|  | log(message:Object, category:String = null):void Sends a log message to the YUI Logger. | YUIAdapter
|  | showFatalError(message:Object):void | YUIAdapter

Property detail

simultaneousUploadLimit | property

`public var simultaneousUploadLimit:Number = 2`

Determines how many files will be uploaded simultaneously

See also

setSimUploadLimit
Constructor detail

Uploader | () | constructor

`public function Uploader()`
Method detail

cancel | () | method

`public function cancel(fileID:String = null):void`

Cancels either an upload of the file corresponding to a given fileID, or in the absence of the specified fileID, all active files being uploaded.

Parameters

| `fileID:String` (default = `null`)`` — The ID of the file to be uploaded

clearFileList | () | method |

`public function clearFileList():Boolean`

Clears the set of files that had been selected for upload

Returns

| `Boolean`

disable | () | method |

`public function disable():void`

enable | () | method |

`public function enable():void`

removeFile | () | method |

`public function removeFile(fileID:String):Object`

Removes the file from the set to be uploaded

Parameters

| `fileID:String` — The ID of the file to be removed

Returns

| `Object`

setAllowLogging | () | method |

`public function setAllowLogging(allowLogging:Boolean):void`

Sets a flag allowing logging in Flash trace and Yahoo logger.

Parameters

| `allowLogging:Boolean` — Whether to allow log messages.

setAllowMultipleFiles | () | method |

`public function setAllowMultipleFiles(allowMultipleFiles:Boolean):void`

Sets a flag allowing multiple file selection in the "Browse" dialog.

Parameters

| `allowMultipleFiles:Boolean` — Whether to allow multiple file selection.

setFileFilters | () | method |

`public function setFileFilters(newFilterArray:Array):void`

Sets a list of file type filters for the "Open File(s)" dialog.

Parameters

| `newFilterArray:Array` — An array of sets of key-value pairs of the form {extensions: extensionString, description: descriptionString, macType: macTypeString [optional]} The extension string is a semicolon-delimited list of elements of the form "xxx", e.g. "jpg;gif;png".

setSimUploadLimit | () | method |

`public function setSimUploadLimit(simUploadLimit:int):void`

Sets the number of simultaneous file uploads possible. The maximum is 5.

Parameters

| `simUploadLimit:int` — Number of simultaneous uploads, no fewer than 1 and no larger than 5.

upload | () | method |

`public function upload(fileID:String, url:String, method:String = "GET", vars:Object = null, fieldName:String = "Filedata"):void`

Uploads a file corresponding to a specified ID to a specified path where a script handles writing to the server.

Parameters

| `fileID:String` — The ID of the file to be uploaded
| `url:String` — The path to the serverside script
| `method:String` (default = "`GET`")`` — The HTTP submission method. Possible values are "GET" and "POST"
| `vars:Object` (default = `null`)`` — An object containing variables to be sent along with the request
| `fieldName:String` (default = "`Filedata`")`` — The field name that precedes the file data in the upload POST operation. The uploadDataFieldName value must be non-null and a non-empty String.

uploadAll | () | method |

`public function uploadAll(url:String, method:String = "GET", vars:Object = null, fieldName:String = "Filedata", headers:Object = null):void`

Uploads all files to a specified path where a script handles writing to the server.

Parameters

| `url:String` — The ID of the file to be uploaded
| `method:String` (default = "`GET`")`` — The path to the serverside script
| `vars:Object` (default = `null`)`` — The HTTP submission method. Possible values are "GET" and "POST"
| `fieldName:String` (default = "`Filedata`")`` — An object containing data to be sent along with the request
| `headers:Object` (default = `null`)`` — The field name that precedes the file data in the upload POST operation. The uploadDataFieldName value must be non-null and a non-empty String.

uploadThese | () | method |

`public function uploadThese(fileIDs:Array, url:String, method:String = "GET", vars:Object = null, fieldName:String = "Filedata"):void`

Uploads the specified files to a specified path where a script handles writing to the server.

Parameters

| `fileIDs:Array` — The IDs of the files to be uploaded
| `url:String` — The path to the serverside script
| `method:String` (default = "`GET`")`` — The HTTP submission method. Possible values are "GET" and "POST"
| `vars:Object` (default = `null`)`` — An object containing data to be sent along with the request
| `fieldName:String` (default = "`Filedata`")`` — The field name that precedes the file data in the upload POST operation. The uploadDataFieldName value must be non-null and a non-empty String.