PHP ftp_nb_get() Function
Complete PHP FTP Reference Manual
Definition and Usage
The ftp_nb_get() function downloads a file from the FTP server and saves it to a local file. (Non-blocking)
This function returns one of the following values:
- FTP_FAILED (send/retrieve failed)
- FTP_FINISHED (send/retrieve succeeded)
- FTP_MOREDATA (send/retrieve in progress)
Unlike ftp_get(), this function retrieves the file asynchronously. This means your program can perform other operations while the file is downloading.
Syntax
ftp_nb_get(ftp_connection,local,remote,mode,resume)
| Parameters | Description |
|---|---|
| ftp_connection | Required. Specifies the FTP connection to use. |
| local | Required. Specifies the local file in which to save the content. If the file already exists, it is overwritten. |
| remote | Required. Specifies the path of the file from which the content is copied. |
| mode | Required. Specifies the transfer mode. Possible values:
|
Example
This example copies text from "source.txt" to "target.txt":
Complete PHP FTP Reference Manual