Something like this should work (I haven't tested it).
# Model
db.define_table('my_uploads',
Field('upload_field', 'upload')
)
# Controller
def upload():
""" Store the upload and return an URL to see the new file """
stored_name = db.my_uploads.upload_field.store(request.vars['file[]']) #
Note that Field.store works fine with cgi.FieldStorage
db.my_uploads.insert(upload_field=stored_name)
return URL('default', 'download', args=stored_name, scheme=True, host=
True)
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.