PHP ftp_fput() Function
Definition and Usage
The ftp_fput() function uploads an already opened file to the FTP server.
Returns true on success, false on failure.
Syntax
ftp_fput(ftp_connection,remote,local,mode,resume)
Parameter | Description |
---|---|
ftp_connection | Required. Specifies the FTP connection to be used (the identifier of the FTP connection). |
remote | Required. The filename to be uploaded to the server. |
local | Required. Specifies the handle of the opened file. |
mode |
Required. Specifies the transfer mode. Possible values are:
|
resume | Required. Specifies where to start copying in the local file. The default is 0. |
Description
Parameter resume Only for PHP 4.3.0 and above versions
Example
This example copies text from "source.txt" to "target.txt":
<?php $source = fopen("source.txt","r"); $conn = ftp_connect("ftp.testftp.com") or die("Could not connect"); ftp_login($conn,"admin","ert456"); echo ftp_fput($conn,"target.txt",$source,FTP_ASCII);; ftp_close($conn); ?>
Output:
1