*** Smitro wrote/escribió (22 Aug 2005 17:07:14 -0700):[color=blue]
> I tried out this example. (you didn't point to exactly which example
> you were refering to)[/color]
There's only one related to this:
<?php
// We'll be outputting a PDF
header('Content-type: application/pdf');
// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');
// The PDF source is in original.pdf
readfile('original.pdf');
?>
[color=blue]
> $file_extension = strtolower(substr(strrchr($filename,"."),1));
>
> //This will set the Content-Type to the appropriate setting for the
> file
> switch( $file_extension ) {
> case "pdf": $ctype="application/pdf"; break;[/color]
Apart from the fact that file extension is sometimes unreliable, it's crazy
to hardcode all possible extensions. Why don't you try mime_content_type()?
[color=blue]
> Fixefox ask if you want to save or open them, but in IE files are just
> read straight into the browser (billions of weird characters).[/color]
Your code looks fine to me. Unluckily, Internet Explorer is a deprecated
buggy browser that'll force you to many workarounds. Some people recommend
to use a generic content type to force download:
application/octet-stream
Also, check whether you're using sessions, cookies or something else that's
adding headers: IE often gets confused.
--
-- Álvaro G. Vicario - Burgos, Spain
--
http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--