An upload field will store the original filename and an obfuscated filename (that is, a new name for the file that contains a unique portion and an encoding of the original name). The obfuscated filename, which looks rather like a hash, is the filename used by the filesystem. The user/download function in the controllers/default.py understands how to handle this. The URL to download an uploaded file is generated by
A(" click to download", _href= URL("download", args=row.fdata)
and looks like
download/uploadf.fdata.81a339e105991c67.454e482d3570317670303956505530653369757a394d73484a64465f70657270657475616c5f5352562d48565f323031393038303631373237.txt
Translating this to display an image, here's a controller function:
def testimg():
row = db(db.uploadf.fname=="test1").select().first()
return dict(img = row.fdata)
using the model
db.define_table('uploadf',
Field('fname', 'string'),
Field('fdata', 'upload'),migrate='uploadf.table')
and the view
testimg.html looks like
{{extend 'layout.html'}}
{{block header}}
Blah!
{{end}}
{{=IMG(_src=URL("download", img), _alt="test image")}}
After the page is loaded, if you use the browser tools to Inspect Element, you're shown
<img alt="test image" src="/updater/download/uploadf.fdata.adbba9e59b5e3383.323031392d776f6d656e732d776f726c642d6375702d6461792d32302d353739383430333339333435343038302d6c61772e676966.gif">
To connect with your auth_user table, you may want to add an extra field that references the file uploaded image.
For more on upload fields, see
<URL:
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-types>
<URL:
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#More-on-uploads>
and
<URL:
http://web2py.com/books/default/chapter/29/09/access-control#Customizing-Auth>
or
<URL:
http://web2py.com/books/default/chapter/31/06/a-camada-de-abstracao-do-banco-de-dados#-Tipos-de-campo>
<URL:
http://web2py.com/books/default/chapter/31/06/a-camada-de-abstracao-do-banco-de-dados#-Mais-sobre-uploads>
and
<URL:
http://web2py.com/books/default/chapter/31/09/controle-de-acesso#-Personalizando-Auth>
for the Portuguese (Spanish is "41" instead of "31" or "29").
Good luck!
Dave S
/dps