[Catalyst] Force file download
Andy Grundman
andy at hybridized.org
Fri Jul 29 18:05:32 CEST 2005
Kevin Old wrote:
> Hello everyone,
>
> I'm generating a spreadsheet for a page in a site I'm developing in
> Catalyst, and I'd like to force the user to download the file. This
> is working quite well, when I make the content_type:
>
> $c->res->headers->content_type('application/octet-stream');
>
> I'd also like to force a filename too, but this doesn't seem to work:
> $c->res->headers->header('Content-Disposition: attachment;
> filename=search.xls');
>
> Any ideas what I might be able to do to get this working?
See the fullcsv method in the ServerDB Report controller, it does
exactly what you need. :)
http://dev.catalyst.perl.org/file/trunk/examples/ServerDB/lib/ServerDB/C/Report.pm
-Andy
More information about the Catalyst
mailing list