I know this question has been asked multiple times but I still can't get it 
to work. I got a table containing an image name:
db.define_table('Images',
    Field('Name',length=512),
    Field('Image','upload'),
    Field('Source',db.Source),
    format = '%(Name)s' # <<< important
    )
db.Images.Quelle.requires=IS_IN_DB(db,'Source.id','Quelle.Source')

Now I gat a table containing an article:
db.define_table('Article',
    Field('Title',length=512),
    Field('Content','text'),
    Field('Sources',length=512),
    Field('Submitted','datetime',default=datetime.datetime.now()),
    Field('Views','integer',default=0),
    Field('Author','reference auth_user',default=auth.user_id),
    Field('TopImage',db.Images)
     )

In my controler I select the the Article which should be displayed:
def Article():
    id=request.vars.id
    row=db(db.Article.id==id).select()
    if len(row)==0:
        redirect(URL(r=request,f='Articles'))
    return dict(Article=row[0])

and in my View I do the following:
{{print URL('download',args=Article.TopImage.Image)}}
<center><img src="{{=URL('download',args=Article.TopImage.Image)}}" />
 </center>
I tried replacing upload with download and various other things. 
One of the Problems I think is that it is looking in delault. but the 
upload folder where the picture lands is in /appname/upload/

Thanks for your help

-- 



Reply via email to