Page 1 of 1
IE Force Download Issues
Posted: Tue Jun 06, 2006 8:49 am
by pennythetuff
I'm having force download issues in IE. I'm forcing the download of a CSV file. Whenever I choose open from the download prompt, and Excel opens I get an error saying that it can't find the file. It works fine in Firefox. It just seems like it's either saving it in one spot and looking for it in another, or it's just not saving it. Thanks in advance.
Posted: Tue Jun 06, 2006 8:52 am
by feyd
code??
Posted: Tue Jun 06, 2006 8:52 am
by pennythetuff
Here's my code:
Code: Select all
header("Pragma: public");
header("Cache-Control: private", false);
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=\"airvoyance.csv\";");
header("Content-Transfer-Encoding: binary");
readfile($filepath);
Posted: Tue Jun 06, 2006 9:25 am
by pennythetuff
The problem was I just wasn't paying attention. In the header:
Code: Select all
header("Content-Disposition: attachment; filename=\"airvoyance.csv\";");
Notice that I have quotes around the filename. I just removed those and it worked fine. Here's the fix:
Code: Select all
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=airvoyance.csv;");
readfile($filepath);
I guess I'll just have to pay more attention next time. Thanks everyone.