Thanks Massimo!
Although the [file|delete] overlaps with the browse button.
On Friday, August 17, 2012 1:05:48 AM UTC+8, Massimo Di Pierro wrote:
>
> form = SQLFORM(db.staff,record)
>
> should be
>
> form = SQLFORM(db.staff,record,upload=URL('download'))
>
> On Thursday, 16 August 2012 11:43:14 UTC-5, lyn2py wrote:
>>
>> Hi guys,
>>
>> I'm using
>> Version 2.00.0 (2012-08-07 22:45:43) dev
>>
>> model
>> db.define_table('staff',
>> Field('user_id','reference auth_user',default=auth.user_id,writable=
>> False,readable=False),
>> Field('photo', 'upload', uploadfield='image_file'),
>> Field('image_file', 'blob')
>> )
>>
>> controller
>> def form():
>> record = db(db.staff.user_id==auth.user_id).select().first()
>> form = SQLFORM(db.staff,record)
>>
>> if form.process().accepted:
>> response.flash = 'form accepted!'
>> elif form.errors:
>> response.flash = 'form has errors'
>>
>> generic views are used.
>>
>> When I load the page "form", the photo doesn't appear like in the manual
>> http://web2py.com/books/default/chapter/29/7#SQLFORM-and-uploads
>> But it appears in the appadmin. Is something missing rom my code?
>>
>
--