I have a thumbnail image inside of an A tag. The src of the a tag leads to a php file that will get the original image from a protected directory outside public_http and push the picture out to the visitor. The url simply looks like this: http://mysite.com/sendFile.php?filename=hello.jpeg

When I click on the image thumbnail, Firefox and IE prompt me to download the image. How do I get it to just show the image instead of trying to download it?
Here is what I am doing now:

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: video/mp4");    
header("Content-Disposition: inline; filename=\"".basename($file)."\";" ); header("Content-Type: application/octet-stream"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($file)); $fp = fopen($file, 'rb'); $buffer = fread($fp, filesize($file)); fclose($fp); print $buffer;

Thank you
gBrent

    why would it be inside an a and not <img src ... ?

      your all so saying its a video, so most clients will prompt to download unless they have a helper app set up for video

        Actually it first says that the file is an MP4 video, and then it says that the file is generic binary data with no particular meaning. One thing it does not claim is that the file is a JPEG image.

          I had to deal with a similar issue. I "learned" that using the Content-Disposition header "forces" the user to see a save-file pop-up.

          This from the manual:

          http://us3.php.net/header

          If you want the user to be prompted to save the data you are sending, such as a generated PDF file, you can use the &#187; Content-Disposition header to supply a recommended filename and force the browser to display the save dialog.

          Perhaps removing that line will let the image to show.

            Write a Reply...