You do not specify the "uploads" directory in the URL. Instead, you need to
define a function that calls response.download() and pass the filename to
that function via the last URL argument (i.e., request.args[-1]). In fact,
this function is already provided for you in the "welcome" app:
def download():
"""
allows downloading of uploaded files
http://..../[app]/default/download/[filename]
"""
return response.download(request,db)
So, your URL should be URL('default', 'download', args=row.image).
This is discussed
here<http://web2py.com/books/default/chapter/29/03#An-image-blog>,
here <http://web2py.com/books/default/chapter/29/07#SQLFORM-and-uploads>,
here <http://web2py.com/books/default/chapter/29/04#response>, and
here<http://www.web2py.com/examples/default/examples#database_examples>(example
33).
Anthony
On Wednesday, December 5, 2012 9:06:57 AM UTC-5, Daniele wrote:
>
> Guys I know this sounds simple but I'm having a hard time displaying
> uploaded images. I have an upload field in my model where logged in users
> can upload an image. But in my views when I try to do
> {{=IMG(_src=URL('uploads/', row.image))}} where row is a variable that
> refers to db(db.auth_user.id > 0).select() nothing is being returned.
> However, row.image returns a string which is the name of the file.
> How can I display the image correctly?
>
> Thanks!
>
--