![]() |
Open unuploaded file - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Open unuploaded file (/thread-19828.html) |
Open unuploaded file - bhojendra - Jul-16-2019 I'm using Flask and requests module. And I'm trying to use post request: 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: 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. RE: Open unuploaded file - micseydel - Jul-19-2019 Can you open the file with a script which does only that? I feel like I need more context on this question. You should provide full, runnable code that reproduces your problem, with the minimum reasonable code necessary to reproduce it. I would estimate 10-20 lines, but if you're posting >50 it's definitely too much. |