Database and files
| From: | David Russell | Date: | Mon, 22 Apr 2002 10:19:17 +0000 |
| Subject: | Database and files | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-93961@lists.php.net to get a copy of this message | ||
Hi all,
I have a database. It receives from my users files - which could be word
documents, Adobe PDF files, text docs, anything...
I store these in a BLOB field of the database.
On a certain page, I include a link to these files which have been saved
into the blob. The link is <a
href="getattachment.php?Fileid=65)">Document</a>.
Now when people link to this (to go to gatattachment.php?fileid=65) the
getattachment does the following:
Finds out the attachment mime type
Sends a:
Header("Content-type: <mime-type>");
Header("Header("Content-Disposition: attachment; filename=\"File65.doc\""
);
Stream the contents of the blob to the browser.
Where the Attachment Filename changes depending on the fileid, and the mime
type (eg. Excel files would be xls)
Now when I click the link, I get garbled content on my browser (no matter
which browser i use - IE, Konqueror, Opera, etc). If I change the headers
to echos, teh I get teh correct results.
What am I doing wrong?
Thanks
David R