"Ben Quinn" <[EMAIL PROTECTED]> wrote:
> I am trying to copy an image from an external server and save it to my
own.
> I have the following script to do this for a txt file and it works great!
>
> ?>
>
> $page  = "../temp/yep.txt";
>
> $date = date("http:/www.example.com/yep.txt");
>
> $cartFile = fopen("$page","a");
> fwrite($cartFile,$date,strlen($date));
> fclose($cartFile);
>
> ?>
>
> But i can't get it to work for image files - the images are saved and
> displayed on screen as a whole bunch of rubbish.

That's because your browser doesn't know the data is an image.  Before you
send the image to the browser you have to use the header() function to send
the browser the proper mime type for the image.  I don't know the mime type
off-hand, but there's probably a tutorial on zend.com or phpbuilder.com that
discusses saving images in a MySQL DB and pulling them out to display on a
webpage using PHP so find one of those articles and look near the end.

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/


-- 
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