On Sep 19, 8:14 am, annet <[email protected]> wrote:
> Does Field(...,uploadfolder="...") make it possible to let every user
> have his own upload folder by assigning a variable to uploadfolder
> like: in the table definition in my model: Field
> (...,uploadfolder=variable) and in the controller: variable="myfolder"
No, since the models execute before the controllers.
The way I'd do this is to override the default setting within the
controller, something like:
def mycontrollerfunction():
db.table.field.uploadfolder = os.path.join(request.folder,
"uploads/%i" % auth.user.id)
form = crud.create(db.table)
...
Which needs a matching:
def download():
db.table.field.uploadfolder = os.path.join(request.folder,
"uploads/%i" % auth.user.id)
return response.download(request, db)
F
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---