Jesus Loves GRASS

Technical blog about GRASS/GIS,open source geoinformatics and MAPSERVER.

Tuesday, June 12, 2007

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

2 Comments:

At 23/12/08 12:07 AM, Anonymous Anonymous said...

Please see this link for the solution.

http://www.webdeveloper.com/forum/archive/index.php/t-30248.html

 
At 23/12/08 8:25 AM, Blogger Unknown said...

Thanks

 

Post a Comment

<< Home