Re: problems with fread()
| From: | (Richard Lynch) | Date: | Wed, 21 Jun 2000 00:20:08 +0000 |
| Subject: | Re: problems with fread() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-2411@lists.php.net to get a copy of this message | ||
In article <NEBBIMGKMMOCANEICHMHMEFICAAA.carlos@ifx.com.br>,
carlos@ifx.com.br ("Carlos Henrique") wrote:
> $in = "http://www.host.com/image.gif";
> $out = "images/image.gif";
>
$f_read = fopen($in,"r") or die("Unable to open $in");
> $img = fread($f_read,filesize($in));
I don't think filesize() works on a URL... Try using, oh, 10000000
instead. Nobody sane has a 10Meg gif.
> fclose($f_read);
>
> $f_write = fopen($out,"w");
> fwrite($f_write,$img);
> fclose($f_write);
Maybe, just maybe, you can do this:
if (!copy($in, $out)){
echo "Copy failed.<BR>\n";
}
Not sure if copy() has been URL-ified yet.
--
Richard Lynch | If this was worth $$$ to you, buy a CD
US Customer Support Director | from one of the artists listed here:
Zend Technologies USA | http://www.L-I-E.com/artists.htm
http://www.zend.com | (this has nothing to do with Zend,
duh!)