Brando,

Thanks for working this out!

it would be good to make a web2py slice or add it to the documentation/ examples

Calvin

On 8 January 2014 14:35, Brando <bhe...@trustcc.com> wrote:
> This works, added the requires statement for form validation:
>
> def submit():
>     import datetime
>     form = FORM(LABEL("File(s):"), INPUT(_name='up_files', _type='file',
> _multiple='', requires=IS_NOT_EMPTY()),  BR(),INPUT(_type='submit'))
>     if form.accepts(request.vars, formname="form"):
>         files = request.vars['up_files']
>         if not isinstance(files, list):
>             files = [files]
>         for f in files:
>             print f.filename
>             up_file = db.uploads.up_file.store(f, f.filename)
>             i = db.uploads.insert(notes=request.vars.notes, up_file=up_file,
> filename=f.filename, up_date= datetime.datetime.now())
>             db.commit()
>         return "form submitted" #redirect(URL('data', 'index'))
>     return dict(form=form)
>
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> 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.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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