I\'m using PHPExcel to export some data to user in an excel file. I would like the script to send the excel file to the user immediately after it\'s creation. Here is my tes
Thanks to Mark Baker. His answer has solved the problem. I have written a simple helper method using his approach.
static function SaveViaTempFile($objWriter){
$filePath = sys_get_temp_dir() . "/" . rand(0, getrandmax()) . rand(0, getrandmax()) . ".tmp";
$objWriter->save($filePath);
readfile($filePath);
unlink($filePath);
}
And I have just replaced $objWriter->save('php://output') with SaveViaTempFile($objWriter)