Method FTPClient():getFile() Professional

Download a file from the FTP server.

Syntax
:getFile( <cSourceFileName>, [<cTargetFileName>], [<bProgressBlock>] ) --> lSuccess
Parameters
<cSourceFileName>
The parameter is a character string with the name of the file to be downloaded from the FTP server. <cSourceFileName> must include the filename plus path information specified relative to the current directory on the server. Alternatively, the path may be specified as an absolute path.
<cTargetFileName>
<cTargetFileName> is a character string which specifies the file to be created on the local drive. The parameter must include the filename plus path information specified relative to the current directory. Alternatively, the path may be specified as an absolute path. <cTargetName> is optional and defaults to the filename portion of the path assigned to <cSourceFileName>.
<bProgressBlock>
The optional parameter <bProgressBlock> is a code block which is evaluated while the file is downloaded from the FTP server. The code block can be used for monitoring or visualizing the progress of the file transfer. The code block is evaluated with the following parameters:
{|nRead, nTotal, oSelf| ... } 
The first parameter <nRead> is the number of bytes already transferred from the server. The second parameter <nTotal> indicates the total number of bytes to download. <oSelf> is the FtpClient object which is downloading the file.
Return

The method returns .T. (true) when the file could be downloaded from the FTP server, otherwise .F. (false) is returned.

Description

The method :getFile() transfers a file from the FTP server to the local drive. When a connection to the FTP server does not exist, an attempt to establish a connection is made. The file is then transferred to the client. If the local file specified in <cTargetFileName> already exists, it is overwritten. :getFile() can transfer files of arbitrary size.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.