Current Location: Home> Function Categories> ftp_nb_fput

ftp_nb_fput

Upload the opened file and save it as a file on the FTP server (non-blocking).
Name:ftp_nb_fput
Category:Uncategorized
Programming Language:php
One-line Description:Upload the opened file and save it as a file on the FTP server (non-blocking).

Definition and usage

The ftp_nb_fput() function uploads an open file and saves it as a file on the FTP server (non-blocking).

This function returns the following values:

  • FTP_FAILED (send/receive failed)
  • FTP_FINISHED (send/receive completed)
  • FTP_MOREDATA (send/receive in progress)

Unlike ftp_fput() , this function gets the file asynchronously. This means that your program can perform other actions when the file is downloaded.

Example

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" ) ;

ftp_nb_fput ( $conn , "target.txt" , $source , FTP_ASCII ) ;

ftp_close ( $conn ) ;
?>

grammar

 ftp_nb_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:

  • FTP_ASCII
  • FTP_BINARY
resume Required. Specifies where to start copying in the local file. The default is 0.
Similar Functions
Popular Articles