You are here: Re: Excel files from Database (firefox / IE difference) « All PHP « IT news, forums, messages
Re: Excel files from Database (firefox / IE difference)

Posted by d on 10/10/11 11:39

"John" <no@email> wrote in message
news:43eb3d89$0$29571$da0feed9@news.zen.co.uk...
> John wrote:
>
>> Hi,
>>
>> I'm using php to provide Excel files stored in a database to web users.
>> The important part of my code is this:
>>
>> $buffer = mysql_result($result, 0, 'survey');
>> header("Content-type: application/excel");
>> header("Content-disposition: attachment; filename=test.xls");
>> echo($buffer);
>>
>> This works perfectly with firefox, but not at all with IE.
>>
>> I just get the pop-up "Internet Explorer cannot download viewdoc.php from
>> <site_name>. Internet Explorer wa snot able to open this Internet site.
>> The requested site is eitherunavailable or cannot be found. Please try
>> again later.
>>
>> Any suggestions?
>>
>> BTW, if i change the content type to application/vnd.ms-excel, all it
>> does is give me a security warning before providing the same error
>> message.
>>
>> John
>
> Sometimes it helps to write down your thoughts when solving problems.
>
> After a re-google, I saw this snippet on Joseph Scott's blog:
>
> if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
> session_cache_limiter("public");
> }
>
> Put this in before the session_start() command, and all is well.
>
> Original Source: http://tinyurl.com/9jva2
>
> Cheers,
>
> John

I just send:

header("Cache-control: private");

and all is well :)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация