[QUESTION] Fileupload failed.
See original GitHub issueDescription
I’ve tried a sample code for upload my file but it failed.
from fastapi import FastAPI, File, UploadFile
app = FastAPI()
@app.post("/files/")
async def create_file(file: bytes = File(...)):
return {"file_size": len(file)}
@app.post("/uploadfile/")
async def create_upload_file(file: UploadFile = File(...)):
return {"filename": file.filename}
Result
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (9 by maintainers)
Top Results From Across the Web
Error with file upload question. - Microsoft Community Hub
Hi, how to resolve this error... i unable to edit it as it grey out . error message "There's a problem with the...
Read more >Error "File upload failed - IBM
Problem. Attempting to upload an attachment to an artifact in Engineering Test Management (ETM) using Microsoft Edge throws the error:.
Read more >Why did my upload fail? - Acceptd - Support
To solve this problem, simply try uploading the file again! If you are exporting your videos with iMovie. We recommend selecting the quality...
Read more >File upload failed - coursera.support
Unable to upload a pdf of my assignment multiple attempts via Chrome (also tried Safari). Cleared cache, no firewall, internet connection is ...
Read more >Google Forms Failed to create file upload question
In google forms when I try to make a question that requires users to upload a file I get an error and it...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@amanjazari
It’s worth checking if you have
python-multipart
installed in your environment.Via
pip install python-multipart
you will install the package and this may well solve your issue.EDIT: This tip is also present in the official docs now: https://fastapi.tiangolo.com/tutorial/request-files/
The latest versions (for quite a while now) detect if you use something that would require
python-multipart
and error out quickly giving you instructions about how to fix it.Also, @whillas, that’s not the way to ask. I’m giving you this for free, working on it in my free time. And everyone here is helping in their free time mostly. Please try to be more respectful.