[web2py] Re: Saving an image from another database into your database

2012-07-06 Thread Massimo Di Pierro
Notice that these two lines: Field('image_file','blob'), Field('image_upload','upload',uploadfield= Field('image_file','blob')) should be Field('image_file','blob'), Field('image_upload','upload',uploadfield= 'image_file'), or simply Field('image_upload','upload',uploadfield=

[web2py] Re: Saving an image from another database into your database

2012-07-06 Thread RCTYCO
I believe i found my problem. The problem is with MySQL. I noticed in the MySQL._db._adapter.uploads_in_blob = FALSE. The database adapter doesn't allow uploads_in_blob. MySQLAdapter* *inherents the uploads_in_blob of FALSE from BaseAdapter. Do you know why the uploads_in_blob isn't set to

[web2py] Re: Saving an image from another database into your database

2012-07-06 Thread Massimo Di Pierro
That only sets the default behavior. Only on systems that do not have a writable filesystem (like on GAE and couchdb) files go in blob by default. On relational databases, uploads are stored in files, not in blobs (by default). On Friday, 6 July 2012 16:22:36 UTC-5, RCTYCO wrote: I believe

[web2py] Re: Saving an image from another database into your database

2012-07-05 Thread Massimo Di Pierro
I would do: def getImage(url,db): user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' headers = {'User-Agent': user_agent} req = urllib2.Request(url,,headers) try: response = urllib2.urlopen(req) except urllib2.URLError, e: if hasattr(e,

[web2py] Re: Saving an image from another database into your database

2012-07-05 Thread RCTYCO
Thank you for the quick response. I added the lines above : ( id = db.image.insert(url=url,image=db.image.image_upload.store(response,filename=url)) db.commit() ) It uploaded the information (url and renamed the file) but I don't believe it upload the image to the database. This is what

[web2py] Re: Saving an image from another database into your database

2012-07-05 Thread Massimo Di Pierro
I did not know you were storing it in a blob. Try: def getImage(url,db): user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' headers = {'User-Agent': user_agent} req = urllib2.Request(url,,headers) try: response = urllib2.urlopen(req) except

[web2py] Re: Saving an image from another database into your database

2012-07-05 Thread RCTYCO
Thanks. I need to solve the problem of the file not been uploaded to the blob field. I believe i am doing it correctly. I defined the model db.define_table('image', Field('url','string'), Field('image_file','blob'),

[web2py] Re: Saving an image from another database into your database

2012-07-05 Thread RCTYCO
Do I have to do something like db.define_table('image', Field('url','string'), Field('image_file','blob'), Field('image_upload','upload',uploadfield= Field('image_file','blob')) Where i provided a filed in the uploadfield On Thursday, July 5,