2012/10/26 Jonathan Lundell <[email protected]> > I want to build a dataset (list of lists) in response to a user request > and cause a csv of that dataset to be downloaded. > > I have a working but ugly implementation that uses @service.csv. If I > access the URL > > http://domain.com/app/default/call/csv/foo > > ...it works OK and downloads a file named 'foo'. > > A couple of questions. > > 1. Is there a better way (considering that this is a user request, not > really a web service per se)? > > 2. How do I make the downloaded file, above, be named foo.csv? Maybe set > request.extension? (I tried call.csv in the URL, which still downloaded > 'foo'.) > > Hi Jonathan, to do it you can use:
response.headers['Content-Disposition'] = 'attachment; filename=foo.csv' before returning your function in the controller --

