Hi, I'm having some trouble and was hoping someone could point me in the
right direction.
I'm creating an application which has an input form which stores to a
database. One entry accepts images, but can also be left empty (by using
requires IS_EMPTY_OR). I also have a placeholder image saved under
'static/images'. I want to make it so that if the upload file is left
empty, I store the placeholder image from the 'static/images' folder in the
database entry, otherwise it'll use the image that was uploaded by the user.
Here's my current implementation:
if request.vars.image == "":
##----Enter Code Here----##
else:
image_file = db.user_items.image.store(request.vars.image.file,
request.vars.image.filename)
addItemToData (request.vars.name, request.vars.collection,
request.vars.tag, request.vars.value, request.vars.story, image_file,
auth.user.id, request.vars.tradeable)
redirect(URL('default', 'profile'))
--
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.