mirror of https://github.com/tiangolo/fastapi.git
15 lines
332 B
Python
15 lines
332 B
Python
from fastapi import FastAPI, File, UploadFile
|
|
from typing_extensions import Annotated
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.post("/files/")
|
|
async def create_file(file: Annotated[bytes, File()]):
|
|
return {"file_size": len(file)}
|
|
|
|
|
|
@app.post("/uploadfile/")
|
|
async def create_upload_file(file: UploadFile):
|
|
return {"filename": file.filename}
|