import base64from django.core.files.base import ContentFileformat, imgstr = data.split(';base64,') ext = format.split('/')[-1]data = ContentFile(base64.b64depre(imgstr), name='temp.' + ext) # You can save this as file instance.使用此代码段对base64字符串进行解码。

import base64from django.core.files.base import ContentFileformat, imgstr = data.split(';base64,') ext = format.split('/')[-1]data = ContentFile(base64.b64depre(imgstr), name='temp.' + ext) # You can save this as file instance.使用此代码段对base64字符串进行解码。