|
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.
config:Object - object name/value collection with necessary configuration parameters.
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.
uploaderId:String - Optional partameter. Identification of the uploader. If it is not specified, active uploader is used.
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.
uploaderId:String - Optional partameter. Identification of the uploader. If it is not specified, active uploader is used.
//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.
uploaderId:String - Optional partameter. Identification of the uploader. If it is not specified, active uploader is used.
var filesCount = universalUploader.getFilesCount();
getFile
getFile(String fileId, [String uploaderId])
Returns an instance of File object by a specified id.
fileId:String - Identificator of the file.
uploaderId:String - Optional partameter. Identification of the uploader. If it is not specified, active uploader is used.
var file = universalUploader.getFile(id);
removeFile
removeFile(String fileId, [String uploaderId])
The method removes the item with a specified identificator from fileList.
fileId:String - Identificator of the file.
uploaderId:String - Optional partameter. Identification of the uploader. If it is not specified, active uploader is used.
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.
universalUploader.startUpload();
cancelUpload
cancelUpload()
The method cancels the upload operation.
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.
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.
universalUploader.bindEventListener("UploadProgress", function (uploaderId, file){
alert('progress!!!');
});
unbindEventListener
unbindEventListener()
The method unbinds function from a specified event.
eventName:String - The name of the event. You may find them all at the Events section.
universalUploader.unbindEventListener("UploadProgress");