[development] How do I send a file to the user?
Johan Forngren
johan at forngren.com
Wed Jan 31 22:47:23 UTC 2007
See also: http://api.drupal.org/api/5/function/drupal_set_header
On 1/31/07, Jeremy Epstein <jazepstein at gmail.com> wrote:
>
> 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
>
> http://www.hanselman.com/blog/TheContentDispositionSagaControllingTheSuggestedFileNameInTheBrowsersSaveAsDialog.aspx
> for more details.
>
> Cheers,
> Jaza.
>
--
Regards,
Johan Forngren
johan at forngren.com :: http://johan.forngren.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070131/735e9255/attachment.htm
More information about the development
mailing list