On Friday 25 January 2002 02:16, daniel wrote:
> > When I use the following code, I am not asked if I want to Save the file
> > or Open it. Instead, the contents of the file are displayed in the
> > browser. I am sure that I have missed something simple!!
> > Todd
> > <?php
> > $len = filesize("test.pdf");
> > header("Content-type: application/pdf");
> > header("Content-Length: $len");
> > header("Content-Disposition: attachment; filename=test.pdf");
> > readfile("test.pdf");
> > ?>
> The code you are showing should work... therefore it may be
> something to do with your browser. Try changing the Content-Type
> to something that there is no way you could have ever registered in
> your browser:
> header("Content-Type: x-this-is-a-test/for-php");
> And see if that changes the way it handles it. Of course,
> application/pdf is the CORRECT MIME type, so if this NEW MIME type
> does solve the problem, you should attempt to fix your browser, and
> put the script back the way it was.
I just want to point out that some versions of IE are notoriously buggy
(what's new ;-)) and would try to display any type of file regardless of what
you have for the Content-Type. So if you have a buggy version of IE you need
to upgrade it.
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
A condition in which presence of mind is good, but absence of
body is better.
-- Foolish Dictionary
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]