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

andrew morton drewish at katherinehouse.com
Wed Jan 31 23:05:55 UTC 2007


On 1/31/07, Ernst Plüss <ernst.pluess at gmail.com> wrote:
> 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?

Well if you're actually generating a file file_tranfer() would do the
trick. Though even if you're streaming something the code would give
you good starting point.

http://api.drupal.org/api/HEAD/function/file_transfer

Good luck,
andrew


More information about the development mailing list