如何从图像输入中获取图像并将其转换为base64。
erorr:invalid file: <InMemoryUploadedFile: image.jpg (image/jpeg)>
def fileView(request):
form = FileForm(request.POST or None, request.FILES or None)
if request.method == 'POST':
if form.is_valid:
image = request.FILES.get('image')
with open(image , "wb") as img:
img.write(base64.decodebytes(image))
request.session['image_file'] = img
return redirect('')