Page 1 of 1

Download file in IE from HTTPS

Posted: Sat Aug 21, 2010 1:53 pm
by rizjav_86
I am creating excel files on the fly from my code and then I give a "download" button to users to download the newly created excel file. Everything works fine on all the modern browsers except IE. It gives an error message that "Unable to open this internet site. The requested site is either unavailable or cannot be found. Please try again later"

I have googled this issue and it seems like that IE throws this error for HTTPS (SSL) URLs. microsoft support page says that it can happen if you have any of the following headers:
Pragma: no-cache
Cache-control: no-cache,max-age=0,must-revalidate
In my code I don't have these headers, but when I print the headers from PHP these get included automatically, I also tried to use unset() to get rid of them but still no luck, any help is appreciated. Here is my code below:

Code: Select all

		header("Content-Disposition: attachment; filename=$filename"); 
		header("Content-Type: application/vnd.ms-excel");  

                echo $data;

Re: Download file in IE from HTTPS

Posted: Sat Aug 21, 2010 2:04 pm
by rizjav_86
ok I found the solution, adding the following two headers does the trick in IE.

Code: Select all

		header('Pragma: private');
		header('Cache-control: private, must-revalidate');