Fran is correct. The place to specify the uploadfolder is in the controller (when uploading) and the download function (for downloading). I just tested out the functionality and it works as advertised, enabling every user to have his/her own upload folder.
On Sep 19, 4:33 am, Fran <francisb...@googlemail.com> wrote: > On Sep 19, 8:14 am, annet <annet.verm...@gmail.com> 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 web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---