Hi and thanks :)
Ill try that later. But I need to keep the image outside of the db (not in
a blob field), and only keep a reference to the location of the image on
the disk. I am going to run a python script on the image I am uploading to
do OCR analysis triggered by the Scheduler, so I need the image on the
disk. How can I move the image to somewhere on the disk instead of saving
it in the db?
Cheers
On Monday, March 13, 2017 at 5:42:07 PM UTC+1, Leonel Câmara wrote:
>
> 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.