PHP ftp_fget() Function

The ftp_fget() function is used to downloads a file from the FTP server and saves to an open file. This function was introduced in PHP 4.

Syntax:

ParameterDescriptionIs compulsory
ftp_streamThe link identifier of the FTP connection.compulsory
handleAn open file pointer in which we store the data.compulsory
remote_fileThe remote file path.compulsory
modeThe transfer mode. Must be either FTP_ASCII or FTP_BINARYcompulsory
resumeposThe position in the remote file to start downloading fromOptional

Returns

The ftp_fget( ) function returns true on success or false on failure.

Example 1

Explanation

In the above example, by using ftp_fget() function we are downloading a file from the FTP server and saves to an open file.

Example 2

Explanation

In the above example, by using ftp_fget() function we are downloading the file from FTP server and saves on the given location.

Example 3

Explanation

In the above example, by using ftp_fget() function we are downloading the file from ftp server and save the file on the given location.


Next TopicPHP FTP




Latest Courses