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 urllib2.URLError, e: if hasattr(e, 'reason'): print 'We failed to reach a server.' print 'Reason: ', e.reason elif hasattr(e, 'code'): print 'The server couldn\'t fulfill the request.' print 'Error code: ', e.code id = db.image.insert(url=url,image_uplaod=db.image.image_upload.store(response,filename=url)) db.commit() # not sure if needed, depends on where executed return id def imageLookup(): id = request.vars.id response.headers['Content-Type']='image/jpeg' return db.image[id].image_file On Thursday, 5 July 2012 14:16:55 UTC-5, RCTYCO wrote: > > 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 it uploaded. Image_file is empty. > id,url,image_upload,image_file > '1', 'http://eandata.com/image/products/000/000/015/0000000151122.jpg', > 'image.image_upload.94df8d0ebb1047e0.303030303030303135313132322e6a7067.jpg', > <Null> > > This is my model. > Model > db.define_table('image', > Field('url','string'), > Field('image_upload','upload',uploadfield='image_file'), > Field('image_file','blob')) > > Any suggestions? >