Here are all the headers we send that work in all browsers.

         header("Content-Type: application/pdf");
         header("Content-Disposition: attachment; filename= 
\"{$filename}\"");
         header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
         header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
         header("Cache-Control: must-revalidate");

One other thing that you might have to do is disable zlib compression  
on the download files.  This might be the reason your pdfs are corrupt  
in IE.

         ini_set('zlib.output_compression', 0);  // turn off the built- 
in ZLIB compressiong for attachments

Fred

On Feb 12, 2011, at 7:36 PM, [email protected] wrote:

> More terming suggests that this is a Windows issue, not IE. In  
> encountering thus same thing with Firefox and Safari on Windows.
>
>
>
> On Feb 12, 2011, at 19:11, Wade Preston Shearer <[email protected] 
> > wrote:
>
>> Right.
>>
>> Here's an example of the idea (not my code, but it's the same  
>> concept):
>>
>> $gotten = @mysql_query("select * from pdf order by pid desc limit  
>> 1");
>> $row = @mysql_fetch_assoc($gotten);
>> $bytes = $row[imgdata];
>> header("Content-type: application/pdf");
>> header('Content-disposition: attachment; filename="thing.pdf"');
>> print $bytes;
>>
>>
>> This works in all browsers but IE.
>>
>>
>> On Feb 12, 2011, at 05:14 PM, Sean Thayne <[email protected]> wrote:
>>
>> http://www.php.net/header
>>
>> // We'll be outputting a PDF
>> header('Content-type: application/pdf');
>>
>> // It will be called downloaded.pdf
>> header('Content-Disposition: attachment; filename="downloaded.pdf"');
>>
>> - Sean
>>
>>
>> On Sat, Feb 12, 2011 at 6:08 PM, <[email protected]> wrote:
>> I have a server that is dynamically generating a PDF as a string of  
>> bytes. Initiating a download and sending the bytes out to the  
>> buffer works in all browsers except IE (of course). In IE, the file  
>> cannot be read because it's corrupted. My experience with  
>> downloading files via a script is that it's a delicate science, but  
>> I was able to construct a script a few years ago that has the right  
>> combination of headers and server settings such that it works in  
>> all browsers. This is the first time I have tried to provide a file  
>> download for a file that is generated though (opposed to existing  
>> in the file system). Any tips on how to get this to work in IE?
>>
>> _______________________________________________
>>
>> UPHPU mailing list
>> [email protected]
>> http://uphpu.org/mailman/listinfo/uphpu
>> IRC: #uphpu on irc.freenode.net
>>
>>
>> _______________________________________________
>>
>> UPHPU mailing list
>> [email protected]
>> http://uphpu.org/mailman/listinfo/uphpu
>> IRC: #uphpu on irc.freenode.net
>
> _______________________________________________
>
> UPHPU mailing list
> [email protected]
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net


_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to