On Wednesday, December 16, 2015 at 4:53:41 AM UTC-5, xmarx wrote:
>
> in controller:
>
> def index():
> import os
> form=SQLFORM.factory(Field('name'),Field('file',
> 'upload',uploadfolder=os.path.join(request.folder,'uploads')))
> if form.process().accepted:
> request.flash='file uploaded!'
> return dict(form=form)
>
>
The only problem with using SQLFORM.factory to handle file uploads is that
it will use the DAL upload mechanism to rename the file (including a random
UUID segment). Because there is no database table storing the new filename,
it will now be difficult to retrieve the file, as you will not know the
filename (you would have to scan the whole directory and decode all of the
base-16-encoded parts of the filenames to retrieve the original filenames).
Anthony
--
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.