More information about the Underscore mailing list

[_] Content Disposition Header

Tim Perrett hello at timperrett.com
Thu Oct 4 15:03:22 BST 2007

When forcing a downlaod id usually do something like:

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: application/pdf");
header("Content-Length: ".filesize($thefile));
header("Content-Disposition: attachment; filename=\"".$dname."\"");
header("Content-Transfer-Encoding: binary");

Then do a fpassthru

Cheers

Tim


On 4 Oct 2007, at 14:52, nik lazell wrote:

> Quick question for the PHP peeps out there...
> I'm trying to force a download of a PDF, and it's working fine on a
> mac, and in FF on a PC - but IE is returning the following:
>
> "internet explorer was not able to open this Internet site. The
> requested site is either unavailable or cannot be found. Please try
> again later."
>
>
> Here's my php:
>
> <?php
> 	header('Content-type: application/pdf');
> 	header('Content-Disposition: attachment; filename="my_file.pdf"');
> 	readfile('my_file.pdf');
> ?>
>
>
> Any help much appreciated! Thanks.
> Ni