Re: Display a JPG Image
| From: | Kevin Stone | Date: | Fri, 10 Oct 2003 19:01:43 +0000 |
| Subject: | Re: Display a JPG Image | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165779@lists.php.net to get a copy of this message | ||
Delete the line with header("Content-disposition: ... "). Just set the content type and
output the file.
-Kevin
"Pushpinder Singh Garcha" <pgarcha@adelphia.net> wrote in message news:B4943896-FB3B-11D7-B2DF-000393874598@adelphia.net...
Hello Everyone,
I am trying to display a JPG image to a use, who has logged in. Some
research on google revealed a way to do this. I am using the following
code to display it.
if (session_is_registered("valid_user")){
if(session_is_registered("cmi")){
header("Content-type: image/jpg");
$file = "docs/picture1.jpg";
header("Content-disposition: attachment; filename=$file" );
readfile($file);
}
My question is that while this approach works fine with Mozilla on the
MAC and Win platform. it throws up a dialog box asking whether the user
wants to download the file or view it. However IE on either platforms
does not work fine. On the PC it does not recognize the file extension
correctly. While on the MAC side of things, it just shows the image in
the same frame.
Any suggestions would be most welcome. !
Thanks in advance
Pushpinder Singh