Hi all, I have been trying to get the code to upload(FTP) the complete contents of a Folder but with no success.
Here is my code:
Here is my code:
function ERRORCHECKING()
err = Application.GetLastError();
if err ~= 0 then
strErrMsg = _tblErrorMessages[err];
Dialog.Message("Error: ", strErrMsg);
end
end
--------------------------------------------------------------------------
--------------------------------------------------------------------------
host = "*******" --
username ="****" --
password = "*****" --
Folder = Dialog.FolderBrowse("Please select a folder:", _DesktopFolder);
Files = File.Find(Folder, "*.jpg", true, true, nil);
file_count = Table.Count(Files);
FTP.Connect(host, username, password, "", true);
ERRORCHECKING();
FTP.ChangeDir("/public_html/Test");
ERRORCHECKING();
FTP.MakeDir(Folder);
ERRORCHECKING();
-- For each file in the chosen folder
-- first update the 'Status Dialog' box
-- then, upload each file in the chosen
-- folder
for n=1,file_count do
StatusDlg.SetMeterRange(0, file_count);
StatusDlg.Show(MB_ICONINFORMATION, false);
StatusDlg.SetMeterPos(n);
StatusDlg.SetTitle("FTP Upload Status . . .");
StatusDlg.SetMessage("FTP Upload in progress . . .");
StatusDlg.SetStatusText("Uploading file"..n.." of a total "..file_count);
FTP.Upload(Files[n], n..".jpg", nil);
ERRORCHECKING();
end
StatusDlg.Hide();
FTP.Disconnect();
Dialog.TimedMessage("FTP Notice!", "Finished uploading!", 2000, MB_ICONINFORMATION);
err = Application.GetLastError();
if err ~= 0 then
strErrMsg = _tblErrorMessages[err];
Dialog.Message("Error: ", strErrMsg);
end
end
--------------------------------------------------------------------------
--------------------------------------------------------------------------
host = "*******" --
username ="****" --
password = "*****" --
Folder = Dialog.FolderBrowse("Please select a folder:", _DesktopFolder);
Files = File.Find(Folder, "*.jpg", true, true, nil);
file_count = Table.Count(Files);
FTP.Connect(host, username, password, "", true);
ERRORCHECKING();
FTP.ChangeDir("/public_html/Test");
ERRORCHECKING();
FTP.MakeDir(Folder);
ERRORCHECKING();
-- For each file in the chosen folder
-- first update the 'Status Dialog' box
-- then, upload each file in the chosen
-- folder
for n=1,file_count do
StatusDlg.SetMeterRange(0, file_count);
StatusDlg.Show(MB_ICONINFORMATION, false);
StatusDlg.SetMeterPos(n);
StatusDlg.SetTitle("FTP Upload Status . . .");
StatusDlg.SetMessage("FTP Upload in progress . . .");
StatusDlg.SetStatusText("Uploading file"..n.." of a total "..file_count);
FTP.Upload(Files[n], n..".jpg", nil);
ERRORCHECKING();
end
StatusDlg.Hide();
FTP.Disconnect();
Dialog.TimedMessage("FTP Notice!", "Finished uploading!", 2000, MB_ICONINFORMATION);
Comment