Massimo,
> if field is the upload field you can set
>
> db.table.field.uploadfolder = ....
This is my image table:
db.define_table('image',
Field('company_id',db.company,default='',notnull=True,ondelete='CASCADE',writable=False,readable=False),
Field('image_filename',writable=False,readable=False),
Field('file',type='upload',default='',notnull=True,autodelete=True),
Field('positie',default='',notnull=True),
Field('posted_on',type='datetime',writable=False,readable=False),
Field('modified_on',type='datetime',writable=False,readable=False),
migrate=False)
>From your reply I understand that in the function in which the user
can update images I could do:
def update_image():
record=db((db.image.company_id==auth.user.company_id)&(db.image.positie==request.args[0])).select().first()
db.image.file.uploadfolder=os.path.join(request.folder,"uploads/%i" %
auth.user.company_id)
form=crud.update(db.image,record,next=(URL(r=request,f='index')),message=message)
return dict(form=form)
Does the folder have to exist already or will it be made when a folder
named company_company_id doesn't exist?
> User A uploads and image into pathA. If user B wants to
> download the image posted by user A, web2py will search for it in
> pathB.
This won't be a problem, since user A cannot download user B's images
and vice versa.
Kind regards,
Annet.