I updated the FTP2 plugin to version 1.0.0.1. Changes since the release yesterday:
- Functions renamed for better compatibility with the original AutoPlay "FTP" plugin:
FTP2.ConnectExplicit();
FTP2.ConnectImplicit();
FTP2.Disconnect();
FTP2.Upload();
FTP2.Download();
- Some connection parameters are now boolean (as they should have been);
- New function FTP2.ChangeDir();
- New function FTP2.Delete();
- New function FTP2.Rename();
It would nice to know if somebody was able to perform FTPS connections and file transfers with this plugin.
Here is a simple script which uses the available functions so far:
Code:
res = FTP2.ConnectImplicit("192.168.0.14", "admin", "password", 990, true, false);
if (res ~= 0) then
error = Application.GetLastError();
Dialog.Message("FTP2", "Could not establish FTPS connection. ("..error..")");
else
-- attempt secure file upload
filename = "file-" .. System.GetDate(DATE_FMT_ISO) .. System.GetTime(TIME_FMT_HOUR)..System.GetTime(TIME_FMT_MIN)..System.GetTime(TIME_FMT_SEC) .. ".test";
res = FTP2.Upload("D:\\TEMP\\sja.log", filename);
if (res ~= 0) then
error = Application.GetLastError();
Dialog.Message("FTP2", "Could not upload file. ("..error..")");
else
-- rename the remote file
res = FTP2.Rename(filename, "new-" .. filename);
if (res ~= 0) then
error = Application.GetLastError();
Dialog.Message("FTP2", "Could not rename file. ("..error..")");
else
-- attempt download of the renamed file
res = FTP2.Download("new-" .. filename, "D:\\TEMP\\down-" .. filename);
if (res ~= 0) then
error = Application.GetLastError();
Dialog.Message("FTP2", "Could not download file. ("..error..")");
else
-- delete the remote file
res = FTP2.Delete("new-" .. filename);
if (res ~= 0) then
error = Application.GetLastError();
Dialog.Message("FTP2", "Could not delete file. ("..error..")");
else
Dialog.Message("FTP2", "Done.");
end
end
end
end
FTP2.Disconnect();
end
Ulrich