MultiPowUpload 3.3
Methods
  Home page
Contact support

UniversalUploader object methods 

For more information on how to use UniversalUploader methods see How to section.

init

getVersion

getProgressInfo

getFiles

getFilesCount

getFile

removeFile

removeAll

startUpload

cancelUpload

bindEventListener

unbindEventListener

 

init

init(Object config)

Initializes UniversalUploader instance.

Parameters

config:Object - object name/value collection with necessary configuration parameters.

Example

universalUploader.init({
	uploaders: "drag-and-drop, flash, silverlight, classic",
	singleUploader : false,
	holder: "universalUploader",
	width: "600", 
	height: "300",
	//Url to file processing script
	url: "FileProcessinfScripts/PHP/uploadfiles.php"
});

getVersion

getVersion():String

Returns a string representation of the UniversalUploader version number.

getProgressInfo

ProgressInfo getProgressInfo([String uploaderId])

Returns an instance of ProgressInfo class.

Parameters

uploaderId:String - Optional partameter. Identification of the uploader. If it is not specified, active uploader is used.

Example

var progress = universalUploader.getProgressInfo();


getFiles

getFiles([String uploaderId]) File[]

Returns an array of File objects. Each object represents a file selected by a user.

The properties of File objects are described in the File class documentation.

Parameters

uploaderId:String - Optional partameter. Identification of the uploader. If it is not specified, active uploader is used.

Example

//Show files info
var list = universalUploader.getFiles();
for(var i=0; i<list.length; i++)
{
 window.alert("File " + list[i].name + " in list");
}

getFilesCount

getFilesCount([String uploaderId]):long

Returns a count of files in file list.

Parameters

uploaderId:String - Optional partameter. Identification of the uploader. If it is not specified, active uploader is used.

Example

var filesCount = universalUploader.getFilesCount();

getFile

getFile(String fileId, [String uploaderId])

Returns an instance of File object by a specified id.

Parameters

fileId:String - Identificator of the file.
uploaderId
:String - Optional partameter. Identification of the uploader. If it is not specified, active uploader is used.

Example

var file = universalUploader.getFile(id);

removeFile

removeFile(String fileId, [String uploaderId])

The method removes the item with a specified identificator from fileList.

Parameters

fileId:String - Identificator of the file.
uploaderId:String - Optional partameter. Identification of the uploader. If it is not specified, active uploader is used.

Example

The following code removes the first file from the list:

universalUploader.removeFile(universalUploader.getFiles()[0].id);


removeAll

removeAll()

The method removes all items from the list.

startUpload

startUpload()

The method starts the upload of files in the list to a remote server. The files are uploaded one by one.

Example:

universalUploader.startUpload();

cancelUpload

cancelUpload()

The method cancels the upload operation.

Example

The following example uploads approximately half of the files and then cancels the upload.

universalUploader.bindEventListener("UploadProgress", function (uploaderId, file){
if(progress.getTotalPercent() >= 50)
universalUploader.cancelUpload();
});


bindEventListener

bindEventListener(eventName, function)

The method binds a specified function with a specified event. Only one function can be binded to the single event. Next call of bindEventListener method will replace previously binded function.

Parameters

eventName:String - The name of the event. You may find them all in the Events section.
function:Function - The function which should be called for this event.

Example

universalUploader.bindEventListener("UploadProgress", function (uploaderId, file){
alert('progress!!!');
});


unbindEventListener

unbindEventListener()

The method unbinds function from a specified event.

Parameters

eventName:String - The name of the event. You may find them all at the Events section.

Example

universalUploader.unbindEventListener("UploadProgress");