PHP ftp_get( ) Function

The ftp_get() function is used to download a file from the FTP server. The ftp_get() function retrieves a remote file from the FTP server, and saves it into a local file. This function was introduced in PHP 4.

Syntax:

ParameterDescriptionIs compulsory
ftp_streamThe link identifier of the FTP connection.compulsory
local_fileThe local file path(will be overwritten if the file already exists).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_get() function returns true on success or false on failure.

Example 1

Explanation

In the above example, by using ftp_get() function we can download a file from ftp server to local file.

Example 2

Explanation

In the above example, by using ftp_get() we can download the file from FTP server and saves into local space.

Example 3

Explanation

In the above example, by using ftp_get() function we can download the file from FTP server and saves into local file.


Next TopicPHP FTP




Latest Courses