Taken from http://web2py.com/book/default/section/7/2?search=original+filename
Occasionally you may want to store the original filename in a database field. In this case, you need to modify the model and add a field to store it in: db.define_table('person', Field('name', requires=IS_NOT_EMPTY()), Field('image_filename'), Field('image', 'upload')) def display_form(): if len(request.args): records = db(db.person.id==request.args[0]).select() if len(request.args) and len(records): url = URL(r=request, f='download') form = SQLFORM(db.person, records[0], deletable=True, upload=url, fields=['name', 'image']) else: form = SQLFORM(db.person, fields=['name', 'image']) if request.vars.image: form.vars.image_filename = request.vars.image.filename if form.accepts(request.vars, session): response.flash = 'form accepted' elif form.errors: response.flash = 'form has errors' return dict(form=form) -- Thadeus On Wed, Jun 2, 2010 at 3:18 AM, Sverre <sverreodeg...@gmail.com> wrote: > I have an upload field in the DB an want to display the original > filename in a view. How can I do that? >