Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone

I obtained data from MySQL database with PHP script, and after I want export the data to MS Excel file, I managed to export but the aplication itselfs that supported Download with the script bellow, I used the PHPExcel lib:

PHP
$objPHPExcel = new PHPExcel();
$name = 'a_name';
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
header('Content-type: application/vnd.ms-excel');
header('Content-Disposition:inline;filename='.$name.'.xls');
$objWriter->save('php://output');




Before exporting the data,I want that the application displays the user a dialog box that asks where to save, How i can do it ?

thank you in advance
Posted

1 solution

When you add the "Content-type" header which is recognized by the browser, but the content of this type cannot be rendered inside the browser, the browser is supposed to give the user the dialog box you want. You don't need to do anything else, and, in fact, you cannot.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900