PHP ftp_get() function
Definition and Usage
The ftp_get() function downloads a file from the FTP server.
Returns true if successful, false if not.
Syntax
ftp_get(ftp_connection,local,remote,mode,resume)
Parameters | Description |
---|---|
ftp_connection | Required. Specifies the FTP connection to be used (the identifier of the FTP connection). |
local | Required. Specifies the local file. |
remote | Required. Specifies the path of the file to be copied from. |
mode |
Required. Specifies the transfer mode. Possible values include:
|
resume | Required. Specifies where to start copying in the remote file. The default is 0. |
Description
Parameters resume Only for PHP 4.3.0 and above versions
Example
This example copies text from "source.txt" to "target.txt":
<?php $conn = ftp_connect("ftp.testftp.com") or die("Could not connect"); ftp_login($conn,"admin","ert456"); echo ftp_get($conn,"target.txt","source.txt",FTP_ASCII);; ftp_close($conn); ?>
Output:
1