Hi,

You beat me to it. I came up with almost exactly the same code myself
over the weekend. Worked a treat. :O)

Paul.

On Oct 15, 2:35 am, Massimo Di Pierro <massimo.dipie...@gmail.com>
wrote:
> Say you have
>
> db.define_table('mytable',Field('file','upload'))
>
> step 1: add a blob
>
> db.define_table('mytable',Field('file','upload',uploadfield='fileblob'),Fie 
> ld('fileblob','blob')
>
> step 2 move the data in blob:
>
> for row in db(db.mytable).select():
>     if row.fileand not row.fileblob:
>        data =
> open(os.path.join(request.folder,'uploads',row.file),'rb').read()
>        row.update_record(fileblob=data)
>        db.commit()
>
> Done
>
> On Oct 14, 6:16 pm, Paul Gerrard <p...@gerrardconsulting.com> wrote:
>
>
>
>
>
>
>
> > Hi all,
>
> > I have the same requirement - moving a directory of upload files into
> > thedatabase. I was thinking the way to do it would be to copy the
> > original table definition, then make the field changes to the table
> > definitions, then write a script to process all thefile-based records
> > and post them into the new table. Sounds simple but probably isn't.
>
> > Has anyone got a working script to do this perhaps?
>
> > Paul.

Reply via email to