JavaPowUpload 2.1
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 the getFiles() method of an JavaPowUpload object.

isFile method

geId 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

The method returns true if the item is a file; false - if it is a folder.

Example

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



getId

String getId()

Description

The method returns unique indentifier of a file.

Example

var index=JavaPowUpload.getFiles().get(0).getId();



getIndex

long getIndex()

Description

The method returns 0-based index of an item.

Example

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



isChecked

boolean isChecked()

Description

The method returns true if the item is checked; otherwise false.

Example

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

 

setChecked

void setChecked(boolean newValue)

Description

The method checks or unckecks an item.

Parameters

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

Example

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

 

getModificationDate

String getModificationDate()

Description

The method returns the Date object that represents last modification date.

Example

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


getFilename

String getFilename()

Description

The method returns only name of a file (without directories).

Example

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

getPath

String getPath()

Description

The method returns the path of the item in the tree without a file name.

Example

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

 

getFullPath

String getFullPath()

Description

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

Example

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

getLength

long getLength()

Description

The method returns file size, in bytes.

Example

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

 

getMD5Hash

String getMD5Hash()

Description

The method returns string representation of file content MD5 hash.

Example

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



getFileSystemPath

String getFileSystemPath()

Description

The method returns full path to a file on user's computer.

Example

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


getDescription

String getDescription()

Description

The method returns a file description text.

Example

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



setDescription

void setDescription(String description)

Description

The 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

The method returns file status constant.


0 - Ready for processing. File has not been uploaded/downloaded.
1 - File is currently being uploaded/downloaded.
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

The method returns file name on remote FTP server. By default, the remote file name is not set (the method returns null), local file name is used.

Example

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



setRemoteFileName

void setRemoteFileName(String rFileName)

Description

The method sets file name on remote FTP server.

Parameters

string rFileName - a file name that used to save the 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. It is similar to HTML "Name" parameter of the Form item.

value -�Value of text Form item. It is similar to HTML "Value" parameter of the Form item.

Example

JavaPowUpload.getFiles().get(0).addPostField("Username","JDoe");

 

getPostField

void getPostField(String name)

Description

Returns a value of the form field with the specified name.

Parameters

name�- Name of a form field.

Example

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

 

removePostField

void removePostField(String name)

Description

Removes a form field with the specified name.

Parameters

name�- Name of a 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();