-
First Check
Commit to Help
Example Codeasync def upload_file_event(files: List[UploadFile]):
print("2", files[0].filename, files[0].file._file.closed)
# ... more code ...
@router.post("/upload_session_file")
async def upload_file(files: List[UploadFile] = File(...)):
print("1", files[0].filename, files[0].file._file.closed)
try:
return StreamingResponse(
upload_file_event(files),
media_type="text/event-stream",
)
except Exception as error:
logging.error(error)
raise HTTPException(status_code=500, detail="Internal Server Error") DescriptionHitting this endpoint with an uploaded file on v0.105.0 will print:
Hitting this endpoint with an uploaded file on v0.106.0 will print:
Unfortunately this means I'm unable to upload files in a StreamingResponse with fastapi>=0.106.0 Operating SystemmacOS Operating System DetailsNo response FastAPI Version0.105.0 Pydantic Version2.5.3 Python Version3.11.4 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Answered by
Kludex
Dec 29, 2023
Replies: 1 comment
-
I've created #10857 from this discussion. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Kludex
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've created #10857 from this discussion.