Hi all, I am using flask on google app engine and am desperately looking for help to solve this. The GAE documentation talks of storing images in the datastore using the BlobProperty , which should be done something like this:-
class MyPics(db.Model):
name=db.StringProperty()
pic=db.BlobProperty()
Now the image should be stored in the datastore by doing this:-
def storeimage():
pics=MyPics()
pics.name=request.form['name']
uploadedpic=request.files['file'] #where file is the fieldname in the form of the
file uploaded
pics.pic=db.Blob(uploadedpic)
pics.put()
redirect ... etc etc
But am unable to do this. as I get db.Blob accepts a string , but given a Filestorage object... Can someone help me with this. Also if anybody could hint me on how to stream the image back after uploading.