[web2py] Re: How to add link for downloading CSV file with specifying filename

2011-12-27 Thread Alan Etkin
One way would be to modify the response.headers object in the
controller with the customized filename.

response.headers[Content-Disposition] = attachment;Filename=%s.doc
% string

And then return the csv data

The user's click would call the web2py action to return de csv (you
can define it in the view)

The web2py book uses this statement (10.1.6) to specify the content:
response.headers['Content-Type']='application/vnd.ms-excel'


On 27 dic, 16:50, thstart thst...@gmail.com wrote:
 I generate CSV content ready to use as a .csv file; don't use a database
 and have a function to do that.

 I want this .csv file to be available for download after click and
 the filename to be set from the application.

 How to do that in web2py?


[web2py] Re: How to add link for downloading CSV file with specifying filename

2011-12-27 Thread Brian M
Yep, Alan's suggestion is what I use too.  See 
https://groups.google.com/d/topic/web2py/qjTF3_wHlWQ/discussion for some 
more details on how I do it