In a table I defined the following field: Field('photoFile',type='upload',autodelete=True),
with the following validator: db.Person.photoFile.requires=IS_EMPTY_OR(IS_IMAGE(extensions=('gif','jpg','jpeg','png'),maxsize=(72,72)),IS_LENGTH(36*1024,error_message='file size exceeds 36 KB')) When I insert a person without a photoFile I get the following error: Traceback (most recent call last): File "/Library/Python/2.5/site-packages/web2py/gluon/restricted.py", line 205, in restricted exec ccode in environment File "/Library/Python/2.5/site-packages/web2py/applications/bootstrap/controllers/appadmin.py" <http://127.0.0.1:8000/admin/default/edit/bootstrap/controllers/appadmin.py>, line 433, in <module> File "/Library/Python/2.5/site-packages/web2py/gluon/globals.py", line 173, in <lambda> self._caller = lambda f: f() File "/Library/Python/2.5/site-packages/web2py/applications/bootstrap/controllers/appadmin.py" <http://127.0.0.1:8000/admin/default/edit/bootstrap/controllers/appadmin.py>, line 128, in insert if form.accepts(request.vars, session): File "/Library/Python/2.5/site-packages/web2py/gluon/sqlhtml.py", line 1207, in accepts newfilename = field.store(source_file, original_filename, field.uploadfolder) UnboundLocalError: local variable 'source_file' referenced before assignment This is in web2py version 1.99.7 Kind regards, Annet --