problems with fread()
| From: | Carlos Henrique | Date: | Fri, 16 Jun 2000 13:50:13 +0000 |
| Subject: | problems with fread() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-2064@lists.php.net to get a copy of this message | ||
Hi folks!!! Sorry to post it again but I really need that and I cant find
help!
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