Help, can't seem to get this write

From: Date: Sat, 20 Jan 2001 04:21:00 +0000
Subject: Help, can't seem to get this write
Groups: php.general 
Request: Send a blank email to php-general+get-35779@lists.php.net to get a copy of this message
I'm trying to make it so I can download the image from a given URL and rewrite it locally on the server. I can connect to the server and get the image and display it. but as soon as I write it it doesn't work, I get either an empty image or a string holder. The code is bleow. the hard coding is just for testing purposes Chris function downloadfile($url, $imageDir) { if(!$file = fopen($url , "r")) { echo ("couldn't open $url\n"); } else { #fpassthru($file); if($file2 = fopen("/www/sinead/images/Full/Sinead200.jpg", "w")) { $content=fread($file, filesize("$file")); fwrite($file2, $content, filesize("$file")); echo ("$file2 created"); } } } ?>

« previous php.general (#35779) next »