On Sunday, June 26, 2011 1:10:48 AM UTC-4, weheh wrote: 
>
> p.s. Massimo - is this anywhere in the doc? If not, I can put it in 
> there for the community. Which chapter should it be in? I would never 
> have figured this out without your response!!!

 
For static file requests, it looks like wsgibase() checks for "attachment" 
at the beginning of the URL query string and then sets the 
"Content-Disposition" HTTP header to "attachment". I went ahead and added 
some documentation about this to the "Dispatching" section of ch. 4, where 
static files are discussed (
http://web2py.com/book/default/chapter/04#Dispatching).
 
Note, you can also set HTTP headers directly via response.headers (e.g., 
response.headers['Content-Disposition']='attachment').
 
Also, if you use the response.download() method to download files that have 
been uploaded (as the download() controller function does), it takes a 
boolean "attachment" argument, which defaults to True.
 
Anthony

Reply via email to