|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-06-03 15:53 UTC] eric at pitte dot de
I'm using php4.3.2RC4 and Apache 2.0.45 using fopen / fread the reading stoped at constant 2.7KB whithout failure report . Here my script: $Map="http://wwwserver.de/map.gif $karte = fopen ($Map, "rb"); $contents = fread ($karte, 1000000); $sid = session_id(); $zeiger=fopen("temp/karte_${sid}.gif","wb"); fwrite($zeiger,$contents); fclose($zeiger); fclose($karte); Any idee ? PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 11:00:02 2025 UTC |
Also from the manual: Note: When reading from network streams or pipes, such as those returned when reading remote files or from popen() and proc_open(), reading will stop after a packet is available. This means that you should collect the data together in chunks as shown in the example below. <?php $handle = fopen ("http://www.php.net/", "rb"); $contents = ""; do { $data = fread ($handle, filesize ($filename)); if (strlen($data) == 0) { break; } $contents .= $data; } fclose ($handle); ?>P.S. - About a week ago I expanded the opening note which phpbug@digvid.info quotes, however the manual has not been rebuilt yet. fread() reads up to length bytes from the file pointer referenced by handle. Reading stops when length bytes have been read, EOF (end of file) is reached, or (for network streams) when a packet becomes available, whichever comes first.