Save base64 image in django file field

import base64

from django.core.files.base import ContentFile
format, imgstr = data.split(';base64,') 
ext = format.split("https://stackoverflow.com/")[-1] 

data = ContentFile(base64.b64decode(imgstr), name="temp." + ext) # You can save this as file instance.

Use this code snippet to decode the base64 string.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)