You managed to bypass the web2py upload mechanism and stored a
FieldStorage object in the database. This is a mistake because it is
difficult to take it out. The problem is probably not in your model
but in the form you use to populate. Can you show us the action?


On Jul 3, 2:29 pm, Lennon <[email protected]> wrote:
> UPDATE:
>
> The error I was getting was caused by a missing ')' in the view so
> fixing that has gotten me to a new error.
>
> I simplified my model to how you have pbreit just to make things
> easier.
>
> But when I try to display the image like so:
>
> <img src="{{=URL('download', args=img['upload'])}}" />
>
> I get a 400 error in the Chrome Console:
>
> http://127.0.0.1:8000/sos_test/default/download/FieldStorage%28%27upl...
> 400 (BAD REQUEST)
>
> There is that field storage again.  I tried doing
> img['upload'].filename as recommended in this link:
>
> http://groups.google.com/group/web2py/browse_thread/thread/9562da3b8b...
>
> But I got an error that the object was a string and .fieldname
> wouldn't work.
>
> Thoughts?
>
> I'm using SQLForm to upload the image.  Maybe I'm doing something
> strange upon upload to store it in such a weird format?
>
> On Jul 3, 1:04 pm, pbreit <[email protected]> wrote:
>
>
>
>
>
>
>
> > I would suggest following the Book more 
> > closely:http://web2py.com/book/default/chapter/03
>
> > db.define_table('image',
> >    Field('caption'),
> >    Field('file', 'upload'))
>
> > <img src="{{=URL('download', args=image.file)}}" />

Reply via email to