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");
     }
   }
 }
?>




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to