FTPS Action Plugin

Description

FTPS is an action plugin that can be used to connect to secure FTP servers, and exchange files.

Actions

FTPS.ChangeDir(string Foldername);

Description:

Changes to a specific folder on the remote FTP server.

Foldername:

(string) The path to the directory on the FTP server that you want to navigate to.

Returns:

(number) 0 if success, 1 otherwise. You can use Application.GetLastError to determine whether this action failed, and why.

Example:

res = FTPS.ChangeDir("/www/cgi-bin/");
if (res ~= 0) then
    error = Application.GetLastError();
    Dialog.Message("FTPS", "Could not change to the folder. ("..error..")");
end

FTPS.ConnectExplicit(string Hostname, string Username, string Password, number Port, number Passive, number ASCII);

Description:

Connects to a secure FTP server, establishing an explicit SSL (AUTH SSL/TLS) connection.

Hostname:

(string) The hostname or IP address of the FTP server to connect to.

Username:

(string) The username to be used on the FTP connection.

Password:

(string) The password to be used.

Port:

(number) The port to connect to. This can be any port, like 21.

Passive:

(boolean) The transfer mode for the files. Passive is more compatible, try it first. Change to active if a firewall blocks the transfer. true = passive, false = active.

ASCII:

(boolean) Specifies binary or text mode file transfers. Use true = ASCII mode, false = binary transfers. Unless you transfer text between Windows and Unix/Linux, use binary.

Returns:

(number) 0 if success, 1 otherwise. You can use Application.GetLastError to determine whether this action failed, and why.

Example:

res = FTPS.ConnectExplicit("192.168.0.14", "Admin", "password", 21, true, false);
if (res ~= 0) then
    error = Application.GetLastError();
    Dialog.Message("FTPS", "Could not open FTP connection. ("..error..")");
end

FTPS.ConnectImplicit(string Hostname, string Username, string Password, number Port, boolean Passive, boolean ASCII);

Description:

Connects to a secure FTP server, establishing an implicit SSL (AUTH SSL/TLS) connection.

Hostname:

(string) The hostname or IP address of the FTP server to connect to.

Username:

(string) The username to be used on the FTP connection.

Password:

(string) The password to be used.

Port:

(number) The port to connect to. Implicit SSL normally uses port 990, but this can be any port, like 21.

Passive:

(boolean) The transfer mode for the files. Passive is more compatible, try it first. Change to active if a firewall blocks the transfer. true = passive, false = active.

ASCII:

(boolean) Specifies binary or text mode file transfers. Use true = ASCII mode, false = binary transfers. Unless you transfer text between Windows and Unix/Linux, use binary.

Returns:

(number) 0 if success, 1 otherwise. You can use Application.GetLastError to determine whether this action failed, and why.

Example:

res = FTPS.ConnectImplicit("192.168.0.14", "Admin", "password", 21, true, false);
if (res ~= 0) then
    error = Application.GetLastError();
    Dialog.Message("FTPS", "Could not open FTP connection. ("..error..")");
end

FTPS.Delete(string Filename);

Description:

Deletes one file on the remote FTP server.

Filename:

(string) The file to be deleted in the current directory on the FTP server.

Returns:

(number) 0 if success, 1 otherwise. You can use Application.GetLastError to determine whether this action failed, and why.

Example:

res = FTPS.Delete("index.html");
if (res ~= 0) then
    error = Application.GetLastError();
    Dialog.Message("FTPS", "Could not delete the file. ("..error..")");
end

FTPS.Disconnect();

Description:

Closes an open connection to a remote secure FTP server gracefully.

Returns:

(number) 0 if success, 1 otherwise. You can use Application.GetLastError to determine whether this action failed, and why.

Example:

-- finishes data exchange with remote server
result = FTPS.Disconnect();

FTPS.Download(string Source, string Destination);

Description:

Downloads a file from remote FTP server.

Source:

(string) The name of the remote file to be downloaded.

Destination:

(string) The name for the local file.

Returns:

(number) 0 if success, 1 otherwise. You can use Application.GetLastError to determine whether this action failed, and why.

Example:

res = FTPS.Download(filename, "C:\\TEMP\\downloaded-" .. filename);
if (res ~= 0) then
    error = Application.GetLastError();
    Dialog.Message("FTPS", "Could not download file. ("..error..")");
end

FTPS.Rename(string Oldname, string Newname);

Description:

Renames one file on the remote FTP server.

Oldname:

(string) The current filename of the file.

Newname:

(string) The new filename of the file in the current directory on the FTP server.

Returns:

(number) 0 if success, 1 otherwise. You can use Application.GetLastError to determine whether this action failed, and why.

Example:

res = FTPS.Rename("test.html", "newindex.html");
if (res ~= 0) then
    error = Application.GetLastError();
    Dialog.Message("FTPS", "Could not rename the file. ("..error..")");
end

FTPS.Upload(string Source, string Destination);

Description:

Uploads a local file to the remote FTP server.

Source:

(string) The full path to the file to be uploaded.

Destination:

(string) The name to be used for the remote file.

Returns:

(number) 0 if success, 1 otherwise. You can use Application.GetLastError to determine whether this action failed, and why.

Example:

filename = "file-" .. System.GetDate(DATE_FMT_ISO) .. System.GetTime(TIME_FMT_MIN) .. System.GetTime(TIME_FMT_SEC) .. ".file";
res = FTPS.Upload("C:\\TEMP\\mytestfile.doc", filename);
if (res ~= 0) then
    error = Application.GetLastError();
    Dialog.Message("FTPS", "Could not upload file. ("..error..")");
end

Error Codes

12001 - Internal error.
12002 - Could not connect to FTP server.
12003 - Not connected to FTP server.
12004 - Could not change to specified remote folder.
12005 - Could not upload file. No permission?
12006 - File not found.

Change Log

1.0.0.1

1.0.0.0

Additional Information

Author:

Ulrich Peters
upeters@mindquake.com.br

Copyright:

Plugin is copyright © 2008 MindQuake Serviços de Informática Ltda.

Website:

http://www.mindquake.com.br


Copyright © 2008 MindQuake Serviços de Informática Ltda.
Todos os direitos reservados.