Problem with Browser Download -> Windows

Topics: Developer Forum, Project Management Forum, User Forum
Nov 10, 2011 at 9:52 PM
Edited Nov 10, 2011 at 9:53 PM

I had a problem with downloading the xls file to IE from Windows2003

I saved the file to the server's hard drive first.
I did NOT use:
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');

This worked for me just fine:

 

header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=MyExcelFile.xls');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($ExcelFilePath));
ob_clean();
flush();
	
readfile($ExcelFilePath);
unlink($ExcelFilePath);