JavaPowUpload object methods
For more information on how to use JavaPowUpload methods see How to section.
void clickBrowse()
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.
JavaPowUpload.clickBrowse();
void clickDownload()
Method starts upload or download process.
JavaPowUpload.clickDownload();
void clickStop()
Cancels upload or download process.
JavaPowUpload.clickStop();
ArrayList getFiles()
Method returns a ArrayList object that contains UploadItem or DownloadItem objects depending on which mode JavaPowUpload started.
ListItem getItem()
void getItem(String filePath)
void getItem(int index)
Method returns UploadItem or DownloadItem object depending on which mode JavaPowUpload started.
filePath - Path to file in tree.
index - Index of item.
var file = JavaPowUpload.getItem('\folder\file.txt');
var file = JavaPowUpload.getItem(0);
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)
Adds file for download. This function does not work in upload mode for security reasons.
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".
JavaPowUpload.addFile("SomeFolder\\testFile.txt","http://somedomain.com/downloads/file.txt","1024","123","false","false")
;
void removeFile(index:Long)
void removeFile(filePath:String)
Removes file from list .
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.
JavaPowUpload.removeFile(0);
void clearTree()
Method removes all files from tree.
JavaPowUpload.clearTree();
ProgressInfo getProgressInfo()
Returns instance of ProgressInfo class.
var progress = JavaPowUpload.getProgressInfo();
String getParam(String paramName)
Returns the value of the specified parameter.
paramName
- Name of parameter, the value of which should be returned.
var uploadUrl = JavaPowUpload.getParam("Upload.UploadUrl");
long getParamLong(String paramName)
Returns long representation of the specified parameter value. If value can not be converted to long, returns 0.
paramName
- Name of parameter, the value of which should be returned.
var fontSize = JavaPowUpload.getParamLong("Common.DetailsArea.FileDetails.FontSize");
boolean getParamBoolg(String paramName)
Returns boolean representation of the specified parameter value. If value can not be converted to boolean, returns false.
paramName
- Name of parameter, the value of which should be returned.
var buttonVisible = JavaPowUpload.getParamBool("Common.ProgressArea.DownloadButton.Visible");
void setParam(String paramName, String paramValue)
Method sets value of specified with paramName parameter to paramValue.
JavaPowUpload.setParam("Upload.UploadUrl","http://localhost/JavaPowUpload/uploadfiles.php")
;
String getLastServerResponse()
Returns last server reply as a string. This function returns not emty value only when JavaPowUpload started in HTTP upload mode.
window.alert(JavaPowUpload.getLastServerResponse());
long getLastStatusCode ()
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.
window.alert(JavaPowUpload.getLastStatusCode());
void addPostField(String name, String value)
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.
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.
JavaPowUpload.addPostField("Username","JDoe");
void removePostFields()
Removes all text Form items added before. Actually this method clear value of Upload.HttpUpload.CustomPostFields parameter
JavaPowUpload.removePostFields();