I create a basic upload example as below. It works fine if the file size is less than 1MB, but got a 400 bad request, "detail": "There was an error parsing the body" once the file size is larger than 1MB. I have installed the python-multipart package.
from typing import List
import uvicorn
from fastapi import FastAPI, UploadFile, File
app = FastAPI(debug=True)
@app.post("/uploadfiles/")
async def create_upload_files(file: UploadFile = File(...)):
return {"filenames": file.filename}
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)