📅  最后修改于: 2022-03-11 14:45:34.935000             🧑  作者: Mango
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.