I\'m sending images as base64 string through ajax to django. In my django view I need to resize the image and save it in the file system.
Here is a base64 string(si
The beginning of the POSTed string (data:image/jpeg;base64,
) is a header and should be removed before the decoding.
The image is corrupted otherwise.
photo = request.POST['photo'].partition('base64,')[2]
image_data = b64decode(photo)
someobject.photo.save('user.jpg', ContentFile(image_data), save=True)