Easy Tutorial
❮ Func String Echo Func String Substr Replace ❯

PHP ftp_get() Function



Definition and Usage

The ftp_get() function downloads a file from an FTP server and saves it to a local file.

The function returns TRUE on success and FALSE on failure.

Syntax

Parameter Description
ftp_connection Required. Specifies the FTP connection to use.
local Required. Specifies the local file to save the content to. If the file already exists, it will be overwritten.
remote Required. Specifies the path of the file to copy content from.
mode Required. Specifies the transfer mode. Possible values are: FTP_ASCII<br> FTP_BINARY
resume Optional. Specifies where to start copying in the remote file. Default is 0.

Example

This example copies text from "source.txt" to "target.txt":

The above code will output:


❮ Func String Echo Func String Substr Replace ❯