views:

39

answers:

1

I'm getting object 'pyamf.amf3.ByteArray' How can I save it to ImageField ?

+1  A: 

obj - an object in django, data - array which get from Flash application
data['finalImage'] - a pyamf.amf3.ByteArray and contains image
obj.image - an ImageField
new_name - name for a picture (without path)


from django.core.files.base import ContentFile  
obj.image.save(new_name, ContentFile(data['finalImage'].read()))  
obj.save()  
mapcuk