See also: http://api.drupal.org/api/5/function/drupal_set_header
On 2/1/07, Moshe Weitzman < weitzman@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.