[prev in list] [next in list] [prev in thread] [next in thread]
List: php-db
Subject: RE: [PHP-DB] force to download file
From: "Lasitha Alawatta" <Lasitha.A () dotw ! com>
Date: 2007-12-18 5:49:10
Message-ID: 6E7274B65DE08549A4F44A97C73791FB0BC6F5A3 () DOTWSEXH01 ! dotw ! ae
[Download RAW message or body]
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@jadesterling.com]
Sent: Tuesday, December 18, 2007 12:14 AM
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
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic