response.stream(path_to_pshysical_file, attachment=True, filename="whatever.pdf") Don't forget the quotes. :) Thanks it works great!
On Monday, October 22, 2012 11:12:32 PM UTC+3, Niphlod wrote: > > if you have generated a physical file > > response.stream(path_to_pshysical_file, attachment=True, > filename=whatever.pdf) > if you have a "virtual file" (e.g., StringIO) > response.stream(virtual_file, attachment=True, filename=whatever.pdf) > > On Monday, October 22, 2012 9:33:21 PM UTC+2, encompass wrote: >> >> How do I return a file to the view? >> Is there a way to give it a file name as it comes out? >> It's a PDF file I generated in the controller. I think I can get it as >> a file like object too. >> As a bonus, how do I delete it after it has been downloaded. (Thought I >> could easily do that in a cron job.) >> BR, >> Jason Brower >> > --

