PHPExcel set specific headers for file format
Posted
by Asif
on Stack Overflow
See other posts from Stack Overflow
or by Asif
Published on 2010-04-08T06:56:16Z
Indexed on
2010/04/08
7:03 UTC
Read the original article
Hit count: 557
Hi,
While googling I found two different sets of headers that need to be set when outputting excel generated in different file format.
for e.g.
For Type "Excel5" headers are:
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");;
header("Content-Disposition: attachment;filename=$filename");
header("Content-Transfer-Encoding: binary ");
For Type "Excel2007" headers are:
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="myfile.xlsx"');
header('Cache-Control: max-age=0');
My question: is there need to set up different headers for each file type as there are other file types also CSV, HTML and PDF?
© Stack Overflow or respective owner