Hi all,
I am using PyAMF to transfer a dynamically generated large image from Flex to Django. On the Django side i receive the encodedb64 data as a parameter:
My Item model as an imagefield. What i have trouble to do is saving the data as the File Django Field.
def save_item(request, uname, data):
""" Save a new item """
item = Item()
img = cStringIO.StringIO()
img.write(base64.b64decode(data))
myFile = File(img)
item.preview.save('fakename.jpg', myFile, save=False)
That would not work because my File object from StringIO misses some properties such as mode, name etc.
I also think that using StringIO will load the image data completely in memory which is bad so i may just give up on the AMF for this particular case and use POST.
What do you think ?