note 107073 added to function.ftp-nb-get
| From: | passerbyxp at gmail dot com | Date: | Thu, 05 Jan 2012 04:24:36 +0000 |
| Subject: | note 107073 added to function.ftp-nb-get | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185366@lists.php.net to get a copy of this message | ||
Note that you may have to keep calling ftp_nb_continue in order to complete the download. For
example, if you do this:
<?php
ftp_nb_get($conn,$localfile,$remotefile,FTP_BINARY)
//do some LONG time work
while(ftp_nb_continue($conn)!=FTP_FINISHED){}
?>
Your local file may only contains a few kilobytes and the later ftp_nb_continue will keep raising
warning of no more data (due to connection time out, I guess).
So you may want to do this instead:
<?php
$dl=ftp_nb_get($conn,$localfile,$remotefile,FTP_BINARY)
//part of long time work
if(ftp_nb_continue($conn)==FTP_MOREDATA) {}
//part of long time work
if(ftp_nb_continue($conn)==FTP_MOREDATA) {}
//continue to do this until you finish the long time work
while(ftp_nb_continue($conn)==FTP_MOREDATA){}
?>
This happened on my Windows XP + PHP 5.3.8 under CLI. Hope this helps someone.
----
Server IP: 69.147.83.197
Probable Submitter: 203.98.176.247
----
Manual Page -- http://www.php.net/manual/en/function.ftp-nb-get.php
Edit -- https://master.php.net/note/edit/107073
Del: integrated -- https://master.php.net/note/delete/107073/integrated
Del: useless -- https://master.php.net/note/delete/107073/useless
Del: bad code -- https://master.php.net/note/delete/107073/bad+code
Del: spam -- https://master.php.net/note/delete/107073/spam
Del: non-english -- https://master.php.net/note/delete/107073/non-english
Del: in docs -- https://master.php.net/note/delete/107073/in+docs
Del: other reasons-- https://master.php.net/note/delete/107073
Reject -- https://master.php.net/note/reject/107073
Search -- https://master.php.net/manage/user-notes.php