AutoPlay Media Studio 9

FTPWI.Download

FTPWI.Download

This is the first topic This is the last topic  

FTPWI.Download

This is the first topic This is the last topic  

OverviewExamples

FTPWI.Download (

string   URL,

string   Filename,

string   Username = "anonymous",

string   Password = "guest@",

number   Mode = MODE_BINARY,

number   Timeout = 20,

number   Port = 21,

boolean PassiveMode = true,

function CallbackFunction = nil )

Example 1

FTPWI.Download("ftp://ftp.yourdomain.com/file.exe", _TempFolder .. "\\file.exe", "FTP_USERNAME", "FTP_PASSWORD", MODE_BINARY, 20, 21, true, nil);

 

err = Application.GetLastError();

 

if err ~= 0 then

   Dialog.Message(err, _tblErrorMessages[err]);

end

Downloads 'file.exe' from an ftp site.  An error message is displayed if an error occurs.

Note: _TempFolder is a built-in variable that contains the path to the user's system "Temp" folder.

Example 2

function FTPCallback(BytesRead, FileSize, TransferRate, SecondsLeft, SecondsLeftFormat, Message)

   Debug.Clear();

   Debug.Print(

   "BytesRead: " .. BytesRead .. "\r\n" ..

   "FileSize: " .. FileSize .. "\r\n" ..

   "TransferRate: " .. TransferRate .. "\r\n" ..

   "SecondsLeft: " .. SecondsLeft .. "\r\n" ..

   "SecondsLeftFormat: " .. SecondsLeftFormat .. "\r\n" ..

   "Message: " .. Message .. "\r\n"

   )

 

   return true;

end

 

Debug.ShowWindow();

FTPWI.Download("ftp://ftp.yourdomain.com/file.exe", _TempFolder .. "\\file.exe", "FTP_USERNAME", "FTP_PASSWORD", MODE_BINARY, 20, 21, true, FTPCallback);

err = Application.GetLastError();

Debug.ShowWindow(false);

 

if err ~= 0 then

   Dialog.Message(err, _tblErrorMessages[err]);

end

Downloads 'file.exe' from an FTP site.  An error message is displayed if an error occurs.  In the above example, the callback function 'FTPCallback' is used to display download information in the debug window.

Note: _TempFolder is a built-in variable that contains the path to the user's system "Temp" folder.

See also: Related Actions


Learn More: Indigo Rose Software - AutoPlay Media Studio - Buy Now - Contact Us