Save base64 image in django file field
import base64
from django.core.files.base import ContentFile
format, imgstr = data.split(';base64,')
ext = format.split('/')[-1]
data = ContentFile(base64.b64decode(imgstr), name='temp.' + ext) # You can save this as file instance.
Use this code snippet to decode the base64 string.
import base64
from django.core.files.base import ContentFile
image_data = requestData['user']['image']
format, imgstr = image_data.split(';base64,')
print("format", format)
ext = format.split('/')[-1]
data = ContentFile(base64.b64decode(imgstr))
file_name = "'myphoto." + ext
user.image.save(file_name, data, save=True) # image is User's model field