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=
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
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
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,
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
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
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'),
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,
8 matches
Mail list logo