PHP ftp_put() Function
Definition and Usage
The ftp_put() function uploads a file to the server.
Returns true on success, false on failure.
Syntax
ftp_put(ftp_connection,remote,local,mode,resume,
) | Description |
---|---|
ftp_connection | Required. Specifies the FTP connection to use (the identifier of the FTP connection). |
remote | Required. The filename on the server to upload to. |
local | Required. Specifies the path of the local file to be uploaded. |
mode |
Required. Specifies the transfer mode. Possible values include:
|
resume | Required. Specifies the position in the local file where the copy should start. The default is 0. |
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_put($conn,"target.txt","source.txt",FTP_ASCII);; ftp_close($conn); ?>
Output:
1