note 48122 deleted from function.header by tularis
| From: | tularis@php.net | Date: | Sun, 12 Dec 2004 21:40:48 +0000 |
| Subject: | note 48122 deleted from function.header by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-81733@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Hello ,
I have used part of the code here to write a download script. So far, I get a download dialog which
saves the pdf docs. On trying to open the pdf docs, I get the following error:
"There was an error opening this document.File does not begin with '%pdf-'.
I guess some how the file does not download properly. Pls. help
Here is the code
<?php
$file = '/fos/cwiq/CWIQ2003/test.pdf';
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Length: '.filesize($file));
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
readfile($file);
?>
Running IIS, windows 2000 sp4, firefox 1.0, IE 6 sp2.
----
Reason: spam