Django base64转图片

import base64 def uploadImg(req): img=request.POST['img'] ines = img.split('base64,') imgData = https://www.it610.com/article/base64.b64decode(ines[1]) timestamp = str(int(time.time())) file_url ='static/upload/%s.%s' % (timestamp, 'jpg') leniyimg = open(file_url, 'wb') leniyimg.write(imgData) leniyimg.close() return JsonResponse({'ret':0,'msg':'success','img':file_url })

【Django base64转图片】

    推荐阅读