IE header problem in Ka Map print_map.php
I was thinking that everything was ok with the printing system, but yesterday I was with my supervisors and he used Internet Explorer, when he tried to download and image file with the screen content of Ka-maps, the IE said:
"Internet Explorer cannot download...cale12000000&output_type=JPEG"
"Internet Explorer was not able to open this Internet site"
Since I saw the & and some GET like structure I thought it was some PHP error....
The problem is in the header creation of the print_map.php, which works fine for Firefox but it has some problems with IE.
I have searched on the PHP tutorial help and read several things and so far the best header is something like this:
$mm_type="image".strtolower($_REQUEST['output_type']);
$filename_ext=$oMap->name . ".".strtolower($_REQUEST['output_type']);
header("Cache-Control: public, must-revalidate\n");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT\n");
header('Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT'.'\n');
header("Cache-Control: no-store, no-cache, must-revalidate\n");
header("Cache-Control: post-check=0, pre-check=0\n", false );
header("Pragma: Internet Explorer is shitty\n"); //Otherwise it will give error
header("Content-Type: " . $mm_type."\n");
header("Content-Length: " .(string)(filesize($szImg))."\n");
header('Content-Disposition: attachment; filename='.$filename_ext."\n");
header("Content-Transfer-Encoding: binary\n");
fpassthru($h);
fclose($h);
-The headers for what I read are prepared for non-cache in HTTP 1.0 and 1.1
-Without the Pragma: (something), IE will give the same error, I haven't found why, but is what people do
- The \n is seems to be necessary for IE7 that needs a more tight header (but I haven't checked if it's true)
Labels: cache, header, Internet Explorer, no error