Hello ,
I have created a RESTAPI server using Flask that send me a file by request
now I need also to upload the file as base64
I have try many thing
I get this error
Thanks ,
I have created a RESTAPI server using Flask that send me a file by request
ZipLocation = '/home/pi/logs/Data.zip' return send_file(str(ZipLocation), as_attachment=True)everything work and I get a working ZIP file
now I need also to upload the file as base64
I have try many thing
try: with open(str(ZipLocation), 'rb') as files: encodeFile = base64.b64encode(files) except Exception as e: print(e) else: return send_file(attachment_filename=encodeFile)but it doesn't work
I get this error
a bytes-like object is required, not '_io.BufferedReader'have also try this
try: test = request.files[str(ZipLocation)] encodeFile = base64.b64encode(test.read()) except Exception as e: print( e) else: return send_file(attachment_filename=encodeFile, as_attachment=True)and here I'm getting :
400 Bad Request: The browser (or proxy) sent a request that this server could not understand.what did I do wrong? missing ?
Thanks ,