Saturday, August 25, 2007

IE opens KMZ as ZIP

Yesterday I've decided to play around with Google Earth so I wrote a small KMZ file, which I've uploaded to my site. However when I've tried to download the KMZ, IE opened the file as ZIP.

After a short search I found out the reason: my hosting site didn't add the Google Earth MIME extension (see the bottom of that page) to the Apache server. Since I don't have the privileges to add the extensions I was looking for a work around. One way I found was to put my KMZ in Google Pages. Ugly and probably not allowed with Google Pages license - putting a file in Google Page as storage only.

After some more digging I found the following solution - create a script that add the correct MIME header (I used PHP but I guess you can do it in ASP very easily):

header('Content-type: application/');
header('Content-Disposition: attachment; filename="myfile.kmz"');


No comments: