Unable to download in IE8

Topics: Developer Forum
Nov 11, 2011 at 6:40 PM

I have been able to generate the .xlsx file and download it with no problem using Firefox, but when I try to download the file using IE8 I get the following error:

"Internet Explorer cannot download [file name] from [server]

Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. PLease try again later."

The file name given has a .xl extension, yet when I download the file in Firefox it has the proper .xlsx extension.

Any ideas on what's causing this?


Jan 3, 2012 at 5:21 PM

I solved the problem! I gradually removed pieces of the code to see if I could isolate what was causing the problem. After getting down to almost nothing I tried removing the


line at the top of the page and that solved it. On other apps I had not used this and so the PHPExcel worked without a glitch, but on this one I had to access some $_SESSION variables in the class. With a little research, I discovered that this is a general problem with IE in accepting a download from PHP. The solution explanation can be found at:


The actual solution is to place this piece of code before calling the start of session:

if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
The download works like a charm in IE now.