On 03/15/2013 05:27 PM, Vincenzo Ampolo wrote:

What am I doing wrong ?


It seems that the problem was that i was returning dict(form=form) all cases, this means to send the file back to the browser (probably).

I've solved like this:

def index():
    form = SQLFORM.factory(
        Field('archive', 'upload',
              uploadfolder='/tmp'),
        Field('operation', 'string',
              requires=IS_IN_SET(('search', 'add')),
              widget=SQLFORM.widgets.radio.widget,
              default='search'))
    if form.process().accepted:
        session.original_filename = request.vars.archive.filename
        session.local_filename = form.vars.archive
        redirect(URL('done'))
    return dict(form=form)

def done():
    response.flash = 'File uploaded'
    print session.original_filename
    print session.local_filename
    return dict()

--
Vincenzo Ampolo
http://goshawknest.wordpress.com/
http://vincenzo-ampolo.net/

--

--- You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to