MIME Downloads
| From: | James Taylor | Date: | Wed, 30 Apr 2003 02:50:13 +0000 |
| Subject: | MIME Downloads | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-145719@lists.php.net to get a copy of this message | ||
Trying to allow users to download database queries in various formats,
such as pdf, excel, and csv. I have all the script created that take
the query results and format the data for each of the formats, but the
problem I'm having now is actually delivering the file when people want
to download it. There is no physical file on the server they are
downloading. The file is basically just stored in a variable.
So, say I have the variable $results, which contains an encoded PDF
file, and I want the person to download it... I'm assuming it would be
something like
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
header("Content-type: application/pdf");
After this though, I'm stuck. How to I finish this part off here? Every
example I've seen so far assumes the file exists on the server. Thanks!