you can use the new "uploadfolder='you/path'" argument to set the
location. Or if you want full control use "uploadfield=False" with
something like:

db.define_table('image'
         Field('filename', 'upload', uploadfield=False,
requires=IS_NOT_EMPTY()),
)

form = SQLFORM(db.image)
if form.accepts(request.vars, session):
        target_filename = ...
        # need to stream or large files could cripple your server
        gluon.fileutils.copystream(request.vars.filename.file, open
(target_filename, 'wb'), int(request.env.content_length))
        db.image.insert(filename=target_filename)

Richard



On Nov 18, 9:23 am, NuclearDragon <nucleardragon...@gmail.com> wrote:
> How can I specify my own filename and upload location for images? I
> can't find in the code where it is doing the upload/save/rename
> processes.
>
> I have a vague idea that it uses shutil somehow, but I just can't see
> where it is being used, or how to interrupt and redirect the process.
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to