Solved using from djang.core.files.base import ContentFile Thanks to Guðmundur H
On Mar 15, 3:21 pm, coulix <cou...@gmail.com> wrote: > 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 has no mode, > name etc. > I also think that using StringIO will load the image data completely > in memory so i may just give up on the AMF for this particular case > and use POST. > > What do you think ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---