[Question]: error when attaching file in chat ----AttributeError("'Request' object has no attribute 'file'")
Self Checks
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report (Language Policy).
- [x] Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) (Language Policy).
- [x] Please do not modify this template :) and fill in all the required fields.
Describe your problem
clear the error
Hi @shivabel502! I'm Dosu and I’m helping the ragflow team.
The error happens because the Quart framework (used by RAGFlow) does not provide a request.file attribute. Instead, you should access uploaded files using await request.files, then retrieve the file(s) with files.getlist("file") or files["file"]. For example:
files = await request.files
if "file" not in files:
# handle missing file
uploaded_file = files["file"]
This change is required after the migration from Flask to Quart, which made request handling asynchronous and changed how files and form data are accessed. Updating your code to use await request.files will resolve the AttributeError. You can see this pattern in the file upload endpoints, such as in api/apps/file_app.py and conversation_app.py (source).
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
I have the same problem after running the original source using Docker, and uploading a file in a chat
which commit id or ragflow version?Running from which yaml file, docker-compose.yml or docker-compose-base.yml? I have made some test and its fine in the latest commit.
it is version 21.1 and running from docker-compose-base.yml still its not working
i took latest code still its working
i took latest code still its working
I cannot understand. Did you mean you've pulled the latest code and still not working?
yes i have pulled the latest code still its not working