ActiveXPowUpload 1.0.1 control documentation

ActiveXPowUpload object methods 



GetItem method

Upload method

Stop method

ShowAddFilesDialog method

ShowAddFolderDialog method

AddFormItem method

RemoveFormItem method

RemoveAllFormItems method

RemoveFile method

RemoveSelectedFiles method

RemoveAllFiles method

Paste method

GetServerReply method

GetServerStatusCode method

GetServerStatusText method

ShowProgressWindow method

HideProgressWindow method


GetItem

FileItem GetItem(index:Long)

FileItem GetItem(path:String)

Description

Method returns a FileItem object coresponding to some item in the file list. Method allows to get item by Index or by file path.

Parameters

index A number that indicates the 0-based index of the item in the list. The value must be greater than or equal to 0 and less than ActiveXPowUpload.FileListItemCount. You should convert index value if it has String type but stores number!

path A full path of the needed file.

Example

var file = ActiveXPowUpload.GetItem(0); //Get file by index;
file = ActiveXPowUpload.GetItem("c:\\file.jpg"); //Get file by its full path;
file = ActiveXPowUpload.GetItem(parseInt("0")); //Use this way to get file if index has String type



Upload

void Upload (bool wait = false)

Description

Method starts files uploading.

There are some restrictions on when the upload method can be invoked. It is an error to start upload twice. You must always wait for the last upload to terminate before starting it again. You are not allowed to start upload inside an event handler. Here “event handler” means only a handler of the ActiveXPowUpload event like OnUploadBegin, OnUploadProgress and so on.

ActiveXPowUpload sends files in the order they appear in the file list. Each file contained within a separate part with a name "FILE<N>". Where <N> is the index of the file in the list. Index is 0-based.

Parameters

wait  If 'wait' is true, the Upload method waits for upload termination. If 'wait' is false, the Upload methods returns as soon as upload process starts. Default value is 'false';

Example

ActiveXPowUpload.Upload(false);
window.alert("If you see this message right away after upload starts then Upload method doesn't wait!");



Stop

void Stop()

Description

Cancels upload. An upload process is notified to terminate. After a while the upload process notices the cancel request and cancels upload. Sometimes, though, the upload progress might complete before the notification received. In this case the upload terminates as usual. The stop methods doesn't wait for upload termination. Generally you can't start the upload immediately after the Stop method. You should wait for a while.

Example

ActiveXPowUpload.Stop();



ShowAddFilesDialog

void ShowAddFilesDialog()

Description

Show "Add files" dialog. Selected files will be added to the list.

Example

ActiveXPowUpload.ShowAddFilesDialog();



ShowAddFolderDialog

void ShowAddFolderDialog()

Description

Show "Add folder " dialog. All files of the selected folder and its subfolders will be added to the list.

Example

ActiveXPowUpload.ShowAddFolderDialog();



AddFormItem

void AddFormItem(name: String, value: String)

Description

Adds a (name, value) pair to the list of text fields that will be sent as text Form items. To prevent possible name duplication the name can’t match the pattern used for naming files. It is “FILE\d+”, i.e. the “FILE” string followed by one or more digits. The name can't be empty.

See also FormItem property.

Parameters

name Name of text Form item. Must be unique. It is similar to the HTML "Name" parameter of a Form item.

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

Example

ActiveXPowUpload.AddFormItem("username", "Jdoe");



RemoveAllFormItems

void RemoveAllFormItems()

Description

Removes all items from the text fields list.

Example

ActiveXPowUpload.RemoveAllFormItems();



RemoveFormItem

void RemoveFormItem(name:String)

Description

Removes text field item from the text fields list with the specified name.

Parameters

name Name of the item. It is similar to the HTML "Name" parameter of a Form item.

Example

ActiveXPowUpload.RemoveFormItem("username");



RemoveFile

void RemoveFile(index:Long)

Description

Removes file list element, either file or folder.

Parameters

index A number that indicates a 0-based index of a file list element. The value must be greater than or equal to 0 and less than ActiveXPowUpload.FileListItemCount.

Example

ActiveXPowUpload.RemoveFile(0);



RemoveSelectedFiles

void RemoveSelectedFiles()

Description

Method removes selected (highlighted) file list items.

Example

ActiveXPowUpload.RemoveSelectedFiles();



RemoveAllFiles

void RemoveAllFiles()

Description

Method removes all file list items.

Example

ActiveXPowUpload.RemoveAllFiles();



Paste

void Paste()

Description

Method adds files from clipboard into the list. If the clipboard contains inappropriate data, nothing will be done. Folders are processed recursively.

Example

ActiveXPowUpload.Paste();



GetServerReply

String GetServerReply(codepage: Long)

Description

Returns server reply as a string. It’s everything that server sents in response to upload. The component isn’t smart enough to detect the server reply encoding itself. You must provide the code page of the server reply.

Parameters

codepage Code page of server reply content. Use 65001 value for UTF-8 content.

Example

window.alert(ActiveXPowUpload.GetServerReply(65001));



GetServerStatusCode

Long GetServerStatusCode ()

Description

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

See also GetServerStatusText.

Example

window.alert(ActiveXPowUpload.GetServerStatusCode());



GetServerStatusText

String GetServerStatusText()

Description

A short description of the HTTP code. For code 200 it is usually "OK". You can find most HTTP errors with short descriptions at the w3.org website.

See also GetServerStatusCode.

Example

window.alert(ActiveXPowUpload.GetServerStatusText());



ShowProgressWindow

void ShowProgressWindow()

Description

Shows upload progress window.

See also HideProgressWindow.

Example

ActiveXPowUpload.ShowProgressWindow();



HideProgressWindow

void HideProgressWindow()

Description

Hides upload progress window.

See also ShowProgressWindow.

Example

ActiveXPowUpload.HideProgressWindow();