Todd-

> 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. If it doesn't fix anything, try
using a different browser, or better yet, a different machine.
Additionally, when working with this type of operation, the first
time you hit the page, it will be cached (in it's incorrect form) in
your browser. Therefore, after making these changes, you should dump
the Disk and Memory cache in your browser, and close and restart
your browser just to be safe.


Daniel


-- 
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]

Reply via email to