Η συνάρτηση ftp_nb_put() του PHP

Ορισμός και χρήση

Η συνάρτηση ftp_nb_put() μεταφέρει αρχεία στο服务器 (μη-βλοκαριστική).

This function returns the following values:

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

With ftp_put() Different, this function retrieves the file asynchronously. This means that your program can perform other operations while the file transfer is in progress.

Syntax

ftp_nb_fput(ftp_connection,remote,local,mode,resume)
Parameters Description
ftp_connection Required. Specifies the FTP connection to use (the identifier for the FTP connection).
remote Required. The file name to be uploaded to the server.
local Required. Specifies the path to the local file to be uploaded.
mode

Required. Specifies the transfer mode. Possible values include:

  • FTP_ASCII
  • FTP_BINARY
resume Required. Specifies where to start copying in the local file. The 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);
?>