ftp_nb_put
(PHP 4 >= 4.3.0, PHP 5)
ftp_nb_put — Speichert eine Datei auf dem FTP-Server (nicht blockierend)
Beschreibung
int ftp_nb_put
( resource $ftp_stream
, string $remote_file
, string $local_file
, int $mode
[, int $startpos
] )
ftp_nb_put() speichert local_file als remote_file auf dem FTP-Server. Der Transfermodus mode muss entweder FTP_ASCII oder FTP_BINARY sein. Der Unterschied zwischen dieser Funktion und ftp_put() ist, dass diese, die Datei asynchron hochlädt, so dass das Programm noch andere Operationen durchführen kann.
Gibt FTP_FAILED, FTP_FINISHED, oder FTP_MOREDATA zurück.
Example#1 ftp_nb_put() Beispiel
// Initiate the Upload
$ret = ftp_nb_put($my_connection, "test.remote", "test.local", FTP_BINARY);
while ($ret == FTP_MOREDATA) {
// Irgendwas machen
echo ".";
// Upload fortsetzen
$ret = ftp_nb_continue($my_connection);
}
if ($ret != FTP_FINISHED) {
echo "Beim Transfer trat ein Fehler auf";
exit(1);
}
Example#2 Ein Upload mit ftp_nb_put() wieder aufnehmen
//Initialisieren
$ret = ftp_nb_put($my_connection, "test.remote", "test.local",
FTP_BINARY, ftp_size("test.remote"));
// ODER: $ret = ftp_nb_put($my_connection, "test.remote", "test.local",
// FTP_BINARY, FTP_AUTORESUME);
while ($ret == FTP_MOREDATA) {
// Irgendwas machen
echo ".";
// Upload fortsetzen
$ret = ftp_nb_continue($my_connection);
}
if ($ret != FTP_FINISHED) {
echo "Beim Transfer trat ein Fehler auf";
exit(1);
}
Siehe auch ftp_nb_fput(), ftp_nb_continue(), ftp_put() und ftp_fput().