SpreadsheetML file extension changed by IE and FF

I am generating a SpreadsheetML file in PHP. When users download the file and save it, by default the file saves as Report.xml and opens in Excel. However, if the chooses to open the file in Excel instead of saving it, the filename is changed to Report.xml.xls, causing Excel to display an error message. How can I stop the xls extension from being added to the filename?

These are the headers that I am sending:

header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename="' . $filename . '.xml"');
header('Cache-Control: max-age=0');
header("Pragma: must-revalidate");

I also tried changing the content-type to text/xml which worked in IE but caused the file to be displayed as raw XML in other browsers.

链接地址: http://www.djcxy.com/p/45464.html

上一篇: 在远程计算机上打开Excel文件

下一篇: SpreadsheetML文件扩展名由IE和FF更改