JavaPowUpload 2.0
JavaPowUpload.UploadItem object
  Home page
Contact support

UploadItem object methods  

UploadItem object provides a way to access individual files added to list. You cannot create an UploadItem object directly. You should obtain it by getFiles() method of an JavaPowUpload object.

isFile method

getIndex method

isChecked method

setChecked method

getModificationDate method

getFilename method

getPath method

getFullPath method

getLength method

getMD5Hash method

getFileSystemPath method

getDescription method

setDescription method

getStatus method

getRemoteFileName method

setRemoteFileName method

addPostField method

getPostField method

removePostField method

clearPostFields method

isFile

boolean isFile()

Description

Method returns true if item is file; false is folder.

Example

var isfile=JavaPowUpload.getFiles().get(0).isFile();



getIndex

long getIndex()

Description

Method returns 0-based index of item.

Example

var index=JavaPowUpload.getFiles().get(0).getIndex(); // index of first file at the list. Value should be 0.



isChecked

boolean isChecked()

Description

Method returns true if item is checked; otherwise false.

Example

var checked=JavaPowUpload.getFiles().get(0).isChecked();

 

setChecked

void setChecked(boolean newValue)

Description

Method checks or unckecks item.

Parameters

boolean newValue - True to set item checked, false to uncheck item.

Example

JavaPowUpload.getFiles().get(0).setChecked(false);

 

getModificationDate

String getModificationDate()

Description

Method returns Date object that represents last modification date.

Example

var modified=JavaPowUpload.getFiles().get(0).getModificationDate();


getFilename

String getFilename()

Description

Method returns only name of file (without directories).

Example

var fileName=JavaPowUpload.getFiles().get(0).getFileName();

getPath

String getPath()

Description

Method returns the path of the item in tree without file name.

Example

var treePath=JavaPowUpload.getFiles().get(0).getPath();

 

getFullPath

String getFullPath()

Description

Method returns the full path of the item (included file name).

Example

var treeFullPath=JavaPowUpload.getFiles().get(0).getFullPath();

getLength

long getLength()

Description

Method returns file size, in bytes.

Example

var length=JavaPowUpload.getFiles().get(0).getLength();

 

getMD5Hash

String getMD5Hash()

Description

Method returns string representation of file content MD5 hash.

Example

var md5=JavaPowUpload.getFiles().get(0).getMD5Hash();



getFileSystemPath

String getFileSystemPath()

Description

Method returns full path to file on user computer.

Example

var userPath=JavaPowUpload.getFiles().get(0).getFileSystemPath();


getDescription

String getDescription()

Description

Method returns file description text.

Example

var userPath=JavaPowUpload.getFiles().get(0).getDescription();



setDescription

void setDescription(String description)

Description

Method sets file description text.

Parameters

string description - New file description text .

Example

JavaPowUpload.getFiles().get(0).setDescription("some text here");



getStatus

Integer getStatus()

Description

Method returns file status constant.

Available values:
0 - Ready for processing. File was not uploaded/downloaded.
1 - File currently uploading/downloading.
2 - Upload/download was completed sucessfully.
3 - Upload/download was stopped.
4 - Error occured.

Example

var status=JavaPowUpload.getFiles().get(0).getStatus();



getRemoteFileName

String getRemoteFileName()

Description

Method returns file name on remote FTP server. By default remote file name not set (method return null), local file name used.

Example

var remoteName=JavaPowUpload.getFiles().get(0).getRemoteFileName();



setRemoteFileName

void setRemoteFileName(String rFileName)

Description

Method sets file name on remote FTP server.

Parameters

string rFileName - File name that used to save file on remote FTP server.

Example

JavaPowUpload.getFiles().get(0).setRemoteFileName("new_file_name.ext");



addPostField

void addPostField(String name, String value)

Description

Adds name–value pair to the list that will be sent as text Form items with this file.

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.getFiles().get(0).addPostField("Username","JDoe");

 

getPostField

void getPostField(String name)

Description

Return value of form field with specified name.

Parameters

name - Name of form field.

Example

window.alert(JavaPowUpload.getFiles().get(0).getPostField("Username"));

 

removePostField

void removePostField(String name)

Description

Remove form field with specified name.

Parameters

name - Name of form field.

Example

window.alert(JavaPowUpload.getFiles().get(0).getPostField("Username"));

 

clearPostFields

void clearPostFields()

Description

Removes all text Form items added before.

Example

JavaPowUpload.getFiles().get(0).clearPostFields();