I noticed that I am missing upload=URL('download') in my SQLFORM.factory,
so I added that in there but it's still not working.I double checked the image name and you were right, I don't know how I must have mistakenly deleted that part but it was indeed "[table_name].[field_name].[rand_string]" I can't think of why else this is not working...I am following the web2py book verbatim... On Thu, Dec 6, 2012 at 3:06 AM, Anthony <[email protected]> wrote: > > Hmm for some reason it's not working for me. I took a look at the source >> code and this is the HTML that is being generated: >> >> <img src="/download/image.**a6e29a6f36771685.**e58699e79c9f2e4a5047.JPG" /> >> >> >> And this is what I have in my view that is generating that code: >> >> {{=IMG(_src=URL('default', 'download', args=row.image))}} >> >> so it seems to be taking the 'download' directory and looking for the >> image there, but as aforementioned, I've set the directory for these images >> to be in: >> >> Field('image', 'upload', uploadfolder=os.path.join(** >> request.folder,'uploads/**profiles/') >> > > No, the URL /download/image... does not imply web2py is looking the the > "download" directory. Remember, URLs do not map to directories (with the > exception of static files). In web2py, URLs always map to applications, > controllers, and functions. In your URL, it looks like the application and > controller are excluded, so "download" will be interpreted by web2py as the > function, and then the filename will be interpreted as request.args(0). > This URL will call the download() function in default.py, which will > ultimately call response.download(request, db), and that function will pull > the filename from request.args(0). > > There is a problem with the filename, though. It starts with "image", > which appears to be the field name, but it should actually start with > "[table_name].[field_name]". I'm not sure how that could have happened. Do > you have the same problem with new images that you upload? Do their > filenames start with the table name, or just with "image"? > > Anthony > > -- > > > > --

