Answers for "django file field from base64"

0

django file field from base64

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.
Posted by: Guest on August-07-2021

Python Answers by Framework

Browse Popular Code Answers by Language