I am using PyAMF to migrate a dynamically created large image from Flex to Django. On the Django side, I get encodedb64 data as a parameter:
My Item model as an image field. I have problems saving data as a Django file 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)
This will not work, because my FileIO object from StringIO skips some properties such as mode, name, etc.
I also think that using StringIO will completely load the image data in memory, which is bad, so I can just abandon AMF for this particular case and use POST.
What do you think?
python flex django pyamf
coulix
source share