RE: force to download file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi , 
Try with this header.


	$export_file = "YourFileName.xls";
	ob_end_clean();
	ini_set('zlib.output_compression','Off');
	
	header('Pragma: public');
	header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date in the past	
	header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
	header('Cache-Control: no-store, no-cache, must-revalidate');
// HTTP/1.1 
	header('Cache-Control: pre-check=0, post-check=0, max-age=0');
// HTTP/1.1
	header ("Pragma: no-cache");
	header("Expires: 0");
	header('Content-Transfer-Encoding: none');
	header('Content-Type: application/vnd.ms-excel;');
// This should work for IE & Opera
	header("Content-type: application/x-msexcel");
// This should work for the rest
	header('Content-Disposition: attachment;
filename="'.basename($export_file).'"');



Regards,
Lasitha

-----Original Message-----
From: Hiep Nguyen [mailto:hnguyen@xxxxxxxxxxxxxxxx] 
Sent: Tuesday, December 18, 2007 12:14 AM
To: php-db@xxxxxxxxxxxxx
Subject:  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
DOTW DISCLAIMER:

This e-mail and any attachments are strictly confidential and intended for the addressee only. If you are not the named addressee you must not disclose, copy or take
any action in reliance of this transmission and you should notify us as soon as possible. If you have received it in error, please contact the message sender immediately.
This e-mail and any attachments are believed to be free from viruses but it is your responsibility to carry out all necessary virus checks and DOTW accepts no liability
in connection therewith. 

This e-mail and all other electronic (including voice) communications from the sender's company are for informational purposes only.  No such communication is intended
by the sender to constitute either an electronic record or an electronic signature or to constitute any agreement by the sender to conduct a transaction by electronic means.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux