Search
 
SCRIPT & CODE EXAMPLE
 

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.
Comment

PREVIOUS NEXT
Code Example
Python :: How to call any function with it name as a string 
Python :: pandas crosstab function(counting) frequencies 
Python :: decode base64 password python 
Python :: df.isna percentage 
Python :: 1051 texes uri solution 
Python :: python ravel function output 
Python :: 1047 uri solution 
Python :: python groupby 1d array 
Python :: google.api_core.exceptions.ServiceUnavailable: 503 The datastore operation timed out, or the data was temporarily unavailable when using stream 
Python :: python slicing string 
Python :: how to open Website from CMD using python 
Python :: rename multiple value in column in pandas 
Python :: How to Remove Items in a Set in Python Using the remove() Method 
Python :: accessing 2d list in python 
Python :: python check vpn ip address 
Python :: check if varible is emyt pyton 
Python :: python equivalent linkedhashmap 
Python :: save PIL image to s3 
Python :: how to extends page in django 
Python :: how to strip characters in python 
Python :: Function argument unpacking in python 
Python :: Problem With This? 
Python :: long format to short in python 
Python :: sort python dictionary with values of list by index of first one 
Python :: python using boolean 
Python :: how to download a website using python 
Python :: how to compare the two key from constant value to list of string in python 
Python :: difference between cut and qcut pandas 
Python :: concat dataset 
Python :: how to delete blank rows from text file in spyder 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =