Свалилось мне тут в ящик письмецо. Я сперва не понял, потом врубился. Это реакция благодарного веб-разработчика на мой пост в php.net, где я описал решение одной проблемы.
Мне было очень приятно прочесть этот отзыв. Никакой корысти, чиста спасиба!
Надеюсь, публикуя письмо, я не причиняю вреда Майку.
Not sure who you are, or if this will get to you, but just wanted to send
you a quick note to say THANK YOU! My recent PHP website was just about
to go production after 3 years of development, and at the last minute the
customer demanded SSL encryption of the site. Everything worked well,
until we tried one of our critical print routines and it failed! with a
nasty error from Internet Explorer.
Don't understand a lot about PHP headers, so I went out to php.net, and came
across your post (below)
I still don't understand a lot about headers, but your solution here fixed
me up in a jiffy! and the site was back up and running perfectly.
So, in case you sometimes think these posts are a futile effort, rest
assured that you saved the day for me with this one!!!!
Thanks, and regards,
vsnake at email dot ru
05-Feb-2006 11:51
in situation when I use SSL, sessions and send file to user technique, MSIE
dont get a file.
This code don't work:
session_start();
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="file.pdf"');
header('Content-Length: ' . filesize($fileName));
readfile($fileName);
And I get a solution:
session_start();
header('Pragma: anytextexeptno-cache', true);
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="file.pdf"');
header('Content-Length: ' . filesize($fileName));
readfile($fileName);
The point is: replace header 'Pragma: no-cache'
Good luck!
Michael Mays - Computer Extraordinaire!
Check out my Website: http://home.comcast.net/~memays
Work like you don't need the money, love like you've never been hurt, and dance like no one's watching.
Very nice! Thank you Mike!
ОтветитьУдалитьI find out an addendum to my solution. In some cases we need replace another header too:
...
header('Pragma: cache=1', true);
header('Cache-Control: cache=on', true);
...