Reply to Re: force as kml download

Your name:

Reply:


Posted by windandwaves on 08/18/07 11:55

On Aug 18, 9:50 am, Jeremy <jer...@pinacol.com> wrote:
> Jeremy wrote:
> > windandwaves wrote:
> >> Hi Folk
>
> >> I would like a php file to be a forced download as KML file, but I am
> >> not sure how to do it.
>
> >> I would like it
>
> >> a. to have the KML extension (e.g. myfile.kml rather than myfile.php)
> >> - I could possible do this by writing the output of myfile.php to
> >> newly created file (myfile.kml) I guess
>
> >> b. force it as a download and have the appropiate header.
>
> >> I copied some code, but I am curious what you would recommend. Here is
> >> the code I copied.
>
> >> header("Pragma: public"); // required
> >> header("Expires: 0");
> >> header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
> >> header("Cache-Control: private",false); // required for certain
> >> browsers
> >> header("Content-Type: application/vnd.google-earth.kml+xml");
> >> header("Content-Transfer-Encoding: binary");
>
> >> Thank you
>
> >> Nicolaas
>
> > Easy way:
>
> > header("Content-Disposition: attachment; filename="foobar.kml");
>
> > Jeremy
>
> Durrr.
>
> header("Content-Disposition: attachment; filename=\"foobar.kml\"");
>
> Haste makes waste :P

Thanks a million, that is simpler than I though!

Thank you.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация