i use this to save image from the web
$filename="blah.jpg";
$url_file = fopen("http://www.site.com/image/01.jpg",'rb');
$newfile = fopen("$filename",'wb');
while (!feof($url_file)) {
$chunk = fread($url_file,1024);
fwrite($newfile,$chunk);
}
fclose($newfile);
fclose($url_file);
echo "image saved as <i>".$filename."</i><br>";
but, somtimes it works. but, sometimes, it saves a black image. like a 80k jpg file with nothing. just black.
why is that? how can i fix it?