filesize() [function.filesize]: stat failed for

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

filesize() [function.filesize]: stat failed for

Post by psychotomus »

the error:
Warning: filesize() [function.filesize]: stat failed for http://image.com.com/gamespot/images/20 ... een001.jpg in /mounted-storage/home45b/sub001/sc18478-RGIJ/www.po2upload.com/mytest.php on line 36

Warning: fread() [function.fread]: Length parameter must be greater than 0 in /mounted-storage/home45b/sub001/sc18478-RGIJ/www.po2upload.com/mytest.php on line 36


my code

Code: Select all

$handle = fopen('http://image.com.com/gamespot/images/' . str_replace('/"', "",$urls[$i]), "rb");
		$contents = fread($handle, filesize('http://image.com.com/gamespot/images/' . str_replace('/"', "",$urls[$i]) ) );
		fclose($handle);


whats the error mean? How can I download that file from the url?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

file_get_contents().

You can't get the size of a file over HTTP without reading the Content-length header. file_get_contents() will do what you're trying to do.
Post Reply