I think the problem is is that request.vars.file is a cgi.FieldStorage object and it lacks a __zero__ method therefore it incorrectly evaluates to false even if the object is present. This is an error in the book. Anyway, the actualy filename is now atumatically base16 encoded in the web2py-assigned filename and it is used to automatically set the filename in the content-disposition.
Massimo On Apr 11, 9:19 am, matclab <mathieu.clab...@gmail.com> wrote: > Hello all, > > I've just tried the recipe from the book p197 : "Storing the > original filename", and I've stumbled upon the following strange > behavior : > > The following piece of code doesn't work (never get inside the IF) > > if request.vars.file: > print "In the IF" > form.vars.file_filename = request.vars.file.filename > > whereas the following worked ok ! > if 'file' in request.vars: > print "In the IF" > form.vars.file_filename = request.vars.file.filename > > I really do not understand what is the problem... > Any idea on how to investigate ? > > -Mathieu -- To unsubscribe, reply using "remove me" as the subject.