fread() and fwrite()

From: Date: Wed, 14 Jun 2000 19:06:20 +0000
Subject: fread() and fwrite()
Groups: php.general 
Request: Send a blank email to php-general+get-1856@lists.php.net to get a copy of this message
Hi folks!!! That's my task: read an image file from a url and then write it on my server. My code is listed below and doesnt work. I've tried with mode 'b' (for binary) in fread and fwrite but still doesnt working. The problems is not file permissions cause the out directory is writable. I noticied the fread function always returns zero. Anyone have tried this before? Any tip or trick to help me? Thanx id advance! $in = "http://www.host.com/image.gif"; $out = "images/image.gif"; $f_read = fopen($in,"r"); $img = fread($f_read,filesize($in)); fclose($f_read); $f_write = fopen($out,"w"); fwrite($f_write,$img); fclose($f_write); Best Regards, Carlos PS: Before someone ask, no, this script doesnt steal images from sites, its for our partners who share with us piece of html codes and his images! :)

« previous php.general (#1856) next »