|
JavaPowUpload 2.0
Methods |
Home
page Contact
support
|
JavaPowUpload object methods
For more information on how to use JavaPowUpload methods see How to section.
clickBrowse
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();
clickDownload
void clickDownload()
Method starts upload or download process.
JavaPowUpload.clickDownload();
clickStop
void clickStop()
Cancels upload or download process.
JavaPowUpload.clickStop();
getFiles
ArrayList getFiles()
Method returns a ArrayList object that contains UploadItem or DownloadItem objects depending on which mode JavaPowUpload started.
getItem
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);
addFile
void addFile(String filePath, String url, String length, String id, String uncompress, String delete, String secription)
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".
Description - File description text. Displayed in file tree.
JavaPowUpload.addFile("SomeFolder\\testFile.txt","http://somedomain.com/downloads/file.txt","1024","123","false","false");
removeFile
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);
clearTree
void clearTree()
Method removes all files from tree.
JavaPowUpload.clearTree();
reloadTree
void reloadTree()
Method reload upload tree from current source (html parameters or xml file). Work only in download mode.
JavaPowUpload.reloadTree();
getProgressInfo
ProgressInfo getProgressInfo()
Returns instance of ProgressInfo class.
var progress = JavaPowUpload.getProgressInfo();
getParam
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");
getParamLong
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");
getParamBool
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");
setParam
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");
getLastServerResponse
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());
getLastStatusCode
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());
addPostField
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");
getPostField
void getPostField(String name)
Return value of form field with specified name.
name - Name of text Form item. This similar to HTML "Name" parameter of Form item.
window.alert(JavaPowUpload.getPostField("Username"));
removePostFields
void removePostFields()
Removes all text Form items added before. Actually this method clear value of Upload.HttpUpload.CustomPostFields parameter
JavaPowUpload.removePostFields();
toggleDetailsPanel
void toggleDetailsPanel()
Show/hide DetailsArea
JavaPowUpload.toggleDetailsPanel();