file download suggestions

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I know that is a very old issue but testing an looking around didn't
help me so much. In there is this code to make a file download:

// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);

// HTTP/1.0
header("Pragma: no-cache");

// We'll be outputting a PDF
header('Content-type: application/zip');

// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename=""');

// The PDF source is in original.pdf

And it works fine in firefox, in IE instead when I go to the url it says:

"Internet Explorer cannot download download.php from..."

Any idea?

Thanks, chr
{ Christian Giordano's site and blog @ }

Re: file download suggestions

This might be a case of header overkill.  I have a script creating and
outputting an RTF document, and the end of it looks like this:

header("Content-Type: application/rtf");
header("Content-Disposition: attachment;
header("Content-Length: " . strlen($rtfdoc));
echo $rtfdoc;

Site Timeline