I am working on a feature in which I am proving the excel dump to the user. When user downloads the excel sheet it works fine. the moment user tries open with Microsoft Excel it gives me an error "Excel cant open the file because the file format or the extension is not valid" This is happening only in firefox browser, and in file name .xlsx extension is added automatically.
Code I am using to create the excel dump is
header('Pragma: public');
header("Expires: Mon, 12 Jul 2012 05:00:00 GMT"); // Date in the past
header('Content-Disposition: attachment; filename="excel.xls"');
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');
$header = "Date\t";
$header .= "Other Details Details\t";
echo $header . "\n";
echo "Date1\t";
echo "Detail1\t\n";
echo "Date2\t";
echo "Detail2\t\n";