Net_FTP::get()

Net_FTP::get() -- download a file to the computer your script runs on.

Synopsis

require_once 'Net/FTP.php';

mixed Net_FTP::get (string $remote_file, string $local_file [, bool $overwrite = false [, int $mode = null]])

Description

This downloads a file from the FTP server to the computer your script runs on.

Parameter

Return value

mixed - true on success, otherwise PEAR::Error.

Throws

Several errors may be returned by get. The errornumber is unspecific (until now) and will not tell you anything about the errormessage. Possible errors are:

Table 48-1. Possible PEAR_Error values

Error messageDescriptionSolution
Local file '$local_file' exists and may not be overwriten. The local file you specified exists and you did not specify to overwrite it. Set parameter $overwrite = true.
Local file '$file' is not writeable. Can not overwrite. You specified to overwrite the localfile. This did not work. Maybe you don't have the permission to overwrite the file. Check the filepermissions.
File '$remote_file' could not be downloaded to '$local_file'. The download of the remote file failed. This may have several reasons: Maybe the remote file does not exist or the local directory you wanted to download to does not exist or is not writeable.

Note

This function can not be called statically.

Example