[development] How do I send a file to the user?

Moshe Weitzman weitzman at tejasa.com
Wed Jan 31 22:26:10 UTC 2007

Ernst Plüss wrote:
> Hi
> I want to do the following: The users fills out a form and depending
> on that data an excel export is generated. The user should be prompted
> to store/open the file.
> The code to create the excel data is working fine.
> But I don't know how to do the file sending stuff?
> Is hook_file_download the right way to go? If yes, after I have the
> excel file content stored in a variable how does it get to the
> implementation of hook_file_download?
> Ernst

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.

More information about the development mailing list