note 91099 added to function.ftp-nb-fget
| From: | max at ics dot net dot ua | Date: | Mon, 25 May 2009 11:15:33 +0000 |
| Subject: | note 91099 added to function.ftp-nb-fget | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-155958@lists.php.net to get a copy of this message | ||
Here is more resource efficient sample:
<?php
// get the size of the remote file
$fs = ftp_size($my_connection, "test");
$fp = fopen('test','w');
// Initate the download
$ret = ftp_nb_fget($my_connection, $fp, "README", FTP_BINARY);
while ($ret == FTP_MOREDATA) {
clearstatcache(); // <- this is important
$dld = ftell($fp);
if ( $dld > 0 ){
// calculate percentage
$i = ($dld/$fs)*100;
printf("\r\t%d%% downloaded", $i);
}
// Continue downloading...
$ret = ftp_nb_continue ($my_connection);
}
if ($ret != FTP_FINISHED) {
echo "There was an error downloading the file...";
exit(1);
}
fclose($fp);
?>
----
Server IP: 208.69.120.35
Probable Submitter: 213.154.210.55
----
Manual Page -- http://www.php.net/manual/en/function.ftp-nb-fget.php
Edit -- https://master.php.net/note/edit/91099
Del: integrated -- https://master.php.net/note/delete/91099/integrated
Del: useless -- https://master.php.net/note/delete/91099/useless
Del: bad code -- https://master.php.net/note/delete/91099/bad+code
Del: spam -- https://master.php.net/note/delete/91099/spam
Del: non-english -- https://master.php.net/note/delete/91099/non-english
Del: in docs -- https://master.php.net/note/delete/91099/in+docs
Del: other reasons-- https://master.php.net/note/delete/91099
Reject -- https://master.php.net/note/reject/91099
Search -- https://master.php.net/manage/user-notes.php