PHP ftp_nb_put()Functions
Complete PHP FTP Reference Manual
Definition and Usage
The ftp_nb_put() function uploads a local file to the FTP server. (Non-blocking)
This function returns one of the following values:
- FTP_FAILED (sending/retrieving failed)
- FTP_FINISHED (sending/retrieving successful)
- FTP_MOREDATA (sending/retrieving in progress)
Unlike ftp_put(), this function retrieves the file asynchronously. This means your program can perform other operations while the file is downloading.
Syntax
ftp_nb_put(ftp_connection,remote,local,mode,resume)
| Parameter | Description |
|---|---|
| ftp_connection | Required. Specifies the FTP connection to use. |
| remote | Required. Specifies the file to be saved on the FTP server after uploading. |
| local | Required. Specifies the path of the file to upload. |
| mode | Required. Specifies the transfer mode. Possible values:
|
| resume | Optional. Specifies where to start copying in the local file. 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");
ftp_nb_put($conn,"target.txt","source.txt",FTP_ASCII);
ftp_close($conn);
?>
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
ftp_nb_put($conn,"target.txt","source.txt",FTP_ASCII);
ftp_close($conn);
?>
Complete PHP FTP Reference Manual Other Extensions