Current Location: Home> Function Categories> ftp_fget

ftp_fget

Download a file from the FTP server and save it to a local open file.
Name:ftp_fget
Category:Uncategorized
Programming Language:php
One-line Description:Download a file from the FTP server and save it to a local open file.

Definition and usage

ftp_fget() function downloads a file from the FTP server and saves it to a local open file.

Return true if successful, and false if failed.

Example

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

 <?php
$source = "source.txt" ;
$target = fopen ( "target.txt" , "w" ) ;

$conn = ftp_connect ( "ftp.testftp.com" ) or die ( "Could not connect" ) ;
ftp_login ( $conn , "admin" , "ert456" ) ;

ftp_fget ( $conn , $target , $source , FTP_ASCII ) ;

ftp_close ( $conn ) ;
?>

grammar

 ftp_fget ( ftp_connection , local , remote , mode , resume )
parameter describe
ftp_connection Required. Specifies the FTP connection to be used (the identifier of the FTP connection).
local Required. Handle to the local opened file.
remote Required. Specifies the path to the file from which it is copied.
mode

Required. Specify transmission mode. Possible values ​​are:

  • FTP_ASCII
  • FTP_BINARY
resume Required. Specifies where to start copying in remote files. The default is 0.

illustrate

Parameter resume is only applicable to PHP 4.3.0 or above

Similar Functions
Popular Articles