django file field from base64

Solutions on MaxInterview for django file field from base64 by the best coders in the world

showing results for - "django file field from base64"
Grégoire
08 Jan 2017
1import base64
2
3from django.core.files.base import ContentFile
4format, imgstr = data.split(';base64,') 
5ext = format.split('/')[-1] 
6
7data = ContentFile(base64.b64decode(imgstr), name='temp.' + ext) # You can save this as file instance.
8