For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > December 2007 > Re: [PHP-DB] force to download file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] force to download file
Stephen Johnson

2007-12-17, 7:01 pm

IE likes excel files, and wants to open them for you since it is such a
"helpful" application...

If you want to force the download you need to lie to the browser and claim
you are passing a file that it won't know what to do with.

You can try an exe header, but that will likely prompt security warnings
that will bug your users.



--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




> From: Hiep Nguyen <hnguyen@jadesterling.com>
> Date: Mon, 17 Dec 2007 15:13:45 -0500
> To: <php-db@lists.php.net>
> Subject: [PHP-DB] force to download file
>
> hi all,
>
> i have this on top of my php page:
>
> header("Content-Type: application/vnd.ms-excel");
> header("Content-Disposition: inline; filename=excelfile.xls");
>
> but it is not prompt to save the file instead it opens right in IE.
>
> my question is how do i force the browser prompts to save the file?
>
> thanks

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com