Once upon a time Mark C was quoted as saying:
> Hi,
>
> I'm trying to server an image(s) up from a php script, this script,
> checks for the image and then outputs the required header types, I'm
> trying to get the browsers to download the requested image (when they
> click the link), rather than display inline.
>
> I've got it working on both Mozilla and IE, perfectly, but on the mac's
> on both Safari and IE it displays the image inline.

ok, a little update, using the headers below, it opens a download as for
all the browsers on both Mac/Linux/win

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-type: image/jpg');
header("Content-Type: application/octet-stream");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=".$imageName);
header("Content-Length: ".filesize($imageName));
readfile($imageName);


except (there had to be one), as usuall IE fails to do what it is told, on
the Mac only using the code it tries to download an unkown filefile, of
extension application/force-download.

I've tried moving the headers around, removing the
application/force-download, but these headers are the only ones that will
for IE on both win and Mac to download rather than display it inline.

Also on IE in Mac, it's ignoring the filename being sent and saves it as
the script name (again all other browsers do as required).

The file once downloaded can be renamed, and works fine. whilst this is
fine for me, the avaerage person who will be using the site once finished,
probally will not even know how to rename files, so it has to save it
correctly.

Mark

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to