[development] How do I send a file to the user?
jazepstein at gmail.com
Wed Jan 31 22:41:53 UTC 2007
On 2/1/07, Moshe Weitzman <weitzman at tejasa.com> wrote:
> no, thats not the right function. you just need to send the right http
> headers and then print out your excel data. see http://us2.php.net/header.
> you can use that function directly. no benefit to going through drupal here.
That's right, setting the HTTP headers is the key to doing this. The
most common way to force a file download prompt is to set the
'content-disposition' header, which you can do in PHP like this:
header('Content-Disposition: attachment; filename="downloaded.pdf"');
However, this is not officially part of the HTTP standard (although it
is widely supported), and it has issues with Internet Explorer. See
for more details.
More information about the development