Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #django #file #field
ADD COMMENT
Topic
Name
2+3 =