ftp_fput
Upload an open file and save it as a file on the FTP server.
ftp_fput()
function uploads an open file to the FTP server.
Return true if successful, and false if failed.
This example copies the 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
ftp_fput ( ftp_connection , remote , local , mode , resume )
parameter | describe |
---|---|
ftp_connection | Required. Specifies the FTP connection to be used (the identifier of the FTP connection). |
remote | Required. The file name uploaded to the server. |
local | Required. Specifies the handle to the opened file. |
mode |
Required. Specify transmission mode. Possible values are:
|
resume | Required. Specifies where to start copying in the local file. The default is 0. |
Parameter resume is only applicable to PHP 4.3.0 or above