an upload field contains the web2py-given name of the file. the actual file goes in yourapp/uploads/
to do it manually you need: 1) build its new name filename='%s.%s.%s.%s' % (tablename, fieldname,uuid.uuid4 (),extension) 2) move the file under uploads with that name path=path_to_the_app_uploads_folder shutil.copyfile(oldfilename,os.path.join(path,filename)) 3) insert the new record in database and store the filename in the upload field. On Nov 24, 9:43 am, Marco Prosperi <[EMAIL PROTECTED]> wrote: > hello everybody, I would like to populate the sqlite database of a > web2py application by means of a python script. This script would read > data from a file or another relational database and insert records in > the web2py database (using pyodbc library and sqlite odbc driver for > windows). > My question is about how to fill the field 'image' of this table: > > db.define_table('products', > SQLField('pcode','string'), > SQLField('description','string'), > SQLField('image','upload'), > SQLField('line','string'), > SQLField('category'), > SQLField('stock')) > > If I insert a record in this table using web2py GUI, web2py seems to > translate the name of the image file from myimage.jpg to something > else > > select pcode,description,image from products > > gives this result for me: > > myproduct; mydescription; products.image.2d429188- > d1a0-4ca7-858e-787eeabf4d1a.jpg > > How can I fill the 'image' field via odbc? > > Marco > > but if I have a myimage.jpg file --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---