help - with pdf downloads
| From: | pete M | Date: | Fri, 03 Oct 2003 14:26:10 +0000 |
| Subject: | help - with pdf downloads | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-164900@lists.php.net to get a copy of this message | ||
I'm directing client via a link to a download page for pdf documents.
This code works on mozilla + firebird but in IE however it pops up with a open/save dialog - with the filetype missing and then an error when open/save pressed saying "cannot find the site".
As you can see below I've tried all sorts of variations but still the same error
can someone help me out !!!
tia
Pete
---------------------------------------------------
$dir = '/www/cgi-bin/docu/pdfs/';
$file = $dir.$row['path']."/".$row['file_name'];
$file_name = "file_".trim($_GET['n']).".pdf";
//force download dialog
header("Pragma: no-cache");
//header("Content-type: application/octet-stream\n");
header("Content-type: application/pdf\n");
//header("Content-type: application/x-download");
//header("Content-disposition: inline; filename=$file_name\n");
header("Content-disposition: attachment;filename=$file_name\n");
header("Content-transfer-encoding: binary\n");
//header("Accept-Ranges: bytes");
header("Content-length: " . filesize($file) . "\n");
//send file contents
$fp=fopen($file, "r");
fpassthru($fp);