Hi Anthony, Thanks for your reply. I tried your code and it works. I have a related question, I have a table grp_subgroup which apart from fields groupID, imageFilename and image, also contains fields name and description in a function I have the following code to store the original file name:
record = db.grp_subgroup(groupID=groupID) form = SQLFORM(db.grp_subgroup, record, deletable=True, showid=False, formstyle=bootstrap3, separator='', hidden=dict(nodeID=nodeID)) if request.vars.image != None: form.vars.imageFilename = request.vars.image.filename When the user inserts a subgroup this works, however, when the user updates the name and description and does not re-upload an image I get the following error: Is there a way to prevent this from happening? Traceback (most recent call last): File "/Users/iannet/web2py-deutschland/gluon/restricted.py", line 220, in restricted exec ccode in environment File "/Users/iannet/web2py-deutschland/applications/myleonexus/controllers/group.py" <http://127.0.0.1:8000/admin/default/edit/myleonexus/controllers/image.py>, line 190, in <module> File "/Users/iannet/web2py-deutschland/gluon/globals.py", line 385, in <lambda> self._caller = lambda f: f() File "/Users/iannet/web2py-deutschland/gluon/tools.py", line 3287, in f return action(*a, **b) File "/Users/iannet/web2py-deutschland/applications/myleonexus/controllers/group.py" <http://127.0.0.1:8000/admin/default/edit/myleonexus/controllers/image.py>, line 63, in grp_subgroup form.vars.imageFilename = request.vars.image.filename AttributeError: 'str' object has no attribute 'filename' Is there a way to prevent this from happening? Furthermore, in case of an update form the form does not indicate that an image file has already been uploaded, the image field is a browse button and the message 'no file selected'. I read the book's part on an image blog and SQLFORM and uploads, in the examples the image field shows a file link and an option to delete just the image not the record. I did not get this to work for I wasn't able to figure out how upload=URL('download') works. In case of the img_logo table it has the following scr selector: scr=“/myleonexus/image/download/img_logo.image.beca…67.png” where myleonexus is the application, image is the controller, but download is not a function in the image controller. In case of you solution: folder = 'nodeID' + str(nodeID) db.img_logo.image.uploadfolder = os.path.join(request.env.applications_parent, 'applications', 'dbmodel', 'static', 'uploads', folder) Is it possible to use upload=URL('download') or not? Best, Annet -- 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/d/optout.