How to choose location to save file excel with PHPExcel
Change the file name to desired path i.e,
$name = '/path/to/folder/xyz.xlsx';
$objWriter->save($name);
It Works For Me...
$objWriter->save($filename);
.... change the value of $filename
to be the filepath for wherever you want to save the file, e.g.
$filename = '/path/to/folder/test.xlsx';
$objWriter->save($filename);
If you include below headers to your php file. Your users will have a download option pop-up:
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");;
header("Content-Disposition: attachment;filename=$filename");
header("Content-Transfer-Encoding: binary ");