FtpLoad

Declaration: FtpLoad (FTPParams: TFTPParams; SrcFile, DstFile: string): integer;
The function FtpLoad opens a connection to an FTP server, reads the file SrcFile from the server, stores it in the local file DstFile and disconnects from the server. Please note that the parameter SrcFile must contain the full path on the FTP server. The record FTPParams has to contain the access data of the server (see TFTPParams for details).

The function returns the following error codes:

 0 ... everything is OK
-2 ... source file not found
-3 ... cannot read file (access error)
-4 ... cannot connect to host (check Host address, credentials and/or internet connection)
-5 ... the FTP server does not recognize one or more particular FTP commands
-6 ... path to DstFile does not exist
-9 ... unspecified error

Hint 1: Most FTP servers are Unix-based. Thus the path to the source file (SrcFile) normally uses slashes (/) instead of backslashes (\) to separate directories. Failing to use the correct separation character will result in an error (-2).

Hint 2: As the function FtpLoad opens and closes an FTP connection for the transferred file it is rather slow and should not be used for the transfer of more than a few files. To transfer many files at once use the class TFtpConnection instead.

Hint 3: The function FtpLoad uses passive mode communication to avoid problems with firewalls.