JavaPowUpload 1.0 control documentation

JavaPowUpload object methods 

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



clickBrowse method

clickDownload method

clickStop method

getFiles method

getItem method

addFile method

removeFile method

clearTree method

getProgressInfo method

getParam method

getParamLong method

getParamBool method

setParam method

getLastServerResponse method

getLastStatusCode method

addPostField method

removePostFields method


clickBrowse

void clickBrowse()

Description

In upload mode shows "Browse files" dialog. Selected files and folders will be added to the list. In download mode shows "Choose destination folder" dialog. Files will be downloaded to selected folder.

Example

JavaPowUpload.clickBrowse();



clickDownload

void clickDownload()

Description

Method starts upload or download process.

Example

JavaPowUpload.clickDownload();



clickStop

void clickStop()

Description

Cancels upload or download process.

Example

JavaPowUpload.clickStop();



getFiles

ArrayList getFiles()

Description

Method returns a ArrayList object that contains UploadItem or DownloadItem objects depending on which mode JavaPowUpload started.

Example

var list = JavaPowUpload.getFiles();
for(i=list.size()-1;i>=0;i--)
{
 if(list.get(i).isFile())
  alert(list.get(i).getFullPath());
}


getItem

ListItem getItem()

void getItem(String filePath)

void getItem(int index)

Description

Method returns UploadItem or DownloadItem object depending on which mode JavaPowUpload started.

Parameters

filePath - Path to file in tree.
index - Index of item.

Example

var file = JavaPowUpload.getItem('\folder\file.txt');

var file = JavaPowUpload.getItem(0);

addFile

void addFile(String filePath, String url, String length, String id, String uncompress, String delete)

void addFile(String filePath, String url, String length, String id, String uncompress)

void addFile(String filePath, String url, String length, String id)

void addFile(String filePath, String url, String length)

void addFile(String filePath, String url)

 

Description

Adds file for download. This function does not work in upload mode for security reasons.

Parameters

filePath - Path of file in tree. If some folders not exist in tree they will be created.
url - HTTP or FTP url to the file.
length - Size of file.
id - File id.
uncompress - Uncompress zip file after downloading or not. "true" or "false".
delete - Delete zip file after extracting or not. "true" or "false".

Example

JavaPowUpload.addFile("SomeFolder\\testFile.txt","http://somedomain.com/downloads/file.txt","1024","123","false","false");

removeFile

void removeFile(index:Long)

void removeFile(filePath:String)

Description

Removes file from list .

Parameters

index - A number that indicates the 0-based index of the file in list. The value must be greater than or equal to 0 and less than JavaPowUpload.getFiles().size()

filePath - Path to file in tree.

Example

JavaPowUpload.removeFile(0);

clearTree

void clearTree()

Description

Method removes all files from tree.

Example

JavaPowUpload.clearTree();



getProgressInfo

ProgressInfo getProgressInfo()

Description

Returns instance of ProgressInfo class.

Example

var progress = JavaPowUpload.getProgressInfo();



getParam

String getParam(String paramName)

Description

Returns the value of the specified parameter.

Parameters

paramName - Name of parameter, the value of which should be returned.

Example

var uploadUrl = JavaPowUpload.getParam("Upload.UploadUrl");



getParamLong

long getParamLong(String paramName)

Description

Returns long representation of the specified parameter value. If value can not be converted to long, returns 0.

Parameters

paramNameName of parameter, the value of which should be returned.

Example

var fontSize = JavaPowUpload.getParamLong("Common.DetailsArea.FileDetails.FontSize");


getParamBool

boolean getParamBoolg(String paramName)

Description

Returns boolean representation of the specified parameter value. If value can not be converted to boolean, returns false.

Parameters

paramName - Name of parameter, the value of which should be returned.

Example

var buttonVisible = JavaPowUpload.getParamBool("Common.ProgressArea.DownloadButton.Visible");



setParam

void setParam(String paramName, String paramValue)

Description

Method sets value of specified with paramName parameter to paramValue.

Example

JavaPowUpload.setParam("Upload.UploadUrl","http://localhost/JavaPowUpload/uploadfiles.php");



getLastServerResponse

String getLastServerResponse()

Description

Returns last server reply as a string. This function returns not emty value only when JavaPowUpload started in HTTP upload mode.

Example

window.alert(JavaPowUpload.getLastServerResponse());



getLastStatusCode

long getLastStatusCode ()

Description

HTTP code of server reply. 200 in most cases means success, 500 Internal error. You can find most HTTP errors with short descriptions at w3.org website.

Example

window.alert(JavaPowUpload.getLastStatusCode());



addPostField

void addPostField(String name, String value)

Description

Adds name–value pair to the list that will be sent as text Form items. Actually this method append "name=value" string to the end of Upload.HttpUpload.CustomPostFields parameter.

Parameters

name - Name of text Form item. This similar to HTML "Name" parameter of Form item.

value - Value of text Form item. This similar to HTML "Value" parameter of Form item.

Example

JavaPowUpload.addPostField("Username","JDoe");

 

removePostFields

void removePostFields()

Description

Removes all text Form items added before. Actually this method clear value of Upload.HttpUpload.CustomPostFields parameter

Example

JavaPowUpload.removePostFields();