Given

db.define_table('image',Field('file','upload'))

You can do:

import glob
for filename in glob.glob('*.png'):
    db.image.insert(file=db.image.file.store(open(filename,'rb')))




On Jan 2, 10:55 am, vapirix <[email protected]> wrote:
> I know I can step through my database and add url paths to all of my
> database entries, but is there a way to have web2py process every
> image as an upload (since it's an upload field), and properly store in
> the uploads folder for sake of consistency? It would be a lot better
> than a year from now figuring out which images are being used from a
> folder and which ones the client has uploaded themselves. I'm pre-
> populating their database with the content we do have, and the client
> is going to finish it off later. Simple one, Thanks, guys. =)

Reply via email to