Forum Moderators: coopster
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=data_".date("d-m-y").".xls");
header('Cache-Control: public');
header("Pragma: no-cache");
header("Expires: 0");
echo $thedata;
This works perfectly, except when I move the script to my secure connection. At that point, Firefox will download the file, but IE says it doesn't fine it.
Any ideas?
I have a script that forces the download of a csv file
Good PHP solutions to small problems [webmasterworld.com] msg 9
take a look at those headers, they should help
I checked my and your scripts line by line, and this is the one that did it for me:
header("Pragma: public");
Thanks! :)
On the other hand, when I tried your complete script, it rendered the file in-browser for me. I had to change
header('Content-Disposition: inline; filename="' . $output_file . '"');
to
header('Content-Disposition: attached; filename="' . $output_file . '"');