0

I am using the following code to download a excel file

$objPHPExcel = new PHPExcel();

after this I add data to the Excel object and finally I call the code

header('Content-type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename=$exportFileName');
$objWriter->save('php://output');
die();

Here $exportFileName is the name of the .xlsx file But when I execute the code , the file does not downloads but I can see the following junk characters in the console

the code output

Let me know How to resolve this issue?

Webdev
  • 617
  • 6
  • 24

0 Answers0