I'm using Flask and requests module. And I'm trying to use post request:
So, how can I read temp file?
Or, I'm doing something wrong? Should I send stream data to the server? If so, how should I do that? Please help me understanding to send file to the server.
file = request.files['file'] files = {'file': open(file.filename)} r = requests.post(SERVER, files=files)And in the server:
file = request.files['file'] print(file)I get the following error:
Error:files = {'file': open(file.filename)}\nFileNotFoundError: [Errno 2] No such file or directory: 'run.gif'
I think what I'm doing here is open(file.filename)
is not reading the uploading file. Because, it doesn't read full path.So, how can I read temp file?
Or, I'm doing something wrong? Should I send stream data to the server? If so, how should I do that? Please help me understanding to send file to the server.