El viernes, 28 de diciembre de 2012 06:15:52 UTC-3, Joe Barnhart escribió:
>
> I'm not sure why this is difficult, but I see many posts about this when I 
> search, yet none exactly work for me.  This seems like it should be easy 
> but is surprisingly difficult in web2py.


A possible workaround (worked with SQLite and web2py trunk)

def index():
    form=SQLFORM(db.fileobject)
    if form.process().accepted:
        form.vars.filename = request.vars.theupload.filename
        db.fileobject[form.vars.id].update_record(filename=form.vars.
filename)
    elif form.errors:
        response.flash = 'form has errors'
    return dict(form=form)

The caveat is that you need an extra db command per request

Still, the fact that form.vars.filename doesn't write the new value on db 
insert seems to be a bug.

-- 



Reply via email to