My code worked well on windows, but after I uploaded my web application to the server (linux ubuntu), when uploading files to S3 storage stopped working.
@upload_router.post('')
async def upload_file(
request: Request,
file: Annotated[UploadFile, File()],
):
await s3_client.upload_file(file.file, f'{unique_filename}_{file.filename}')
I’m getting an exception:
raise HTTPClientError(error=e)
botocore.exceptions.HTTPClientError: An HTTP Client raised an unhandled exception: Only io.IOBase, multidict and (name, file) pairs allowed, use .add_field() for passing more complex parameters, got <tempfile.SpooledTemporaryFile object at 0x7f951eab0a00>
I couldn’t solve it.
1