mirror of
https://github.com/fastapi/fastapi.git
synced 2026-11-21 10:13:53 +08:00
19 lines
386 B
Python
19 lines
386 B
Python
from typing import Annotated
|
|
|
|
from fastapi import FastAPI, File, Form, UploadFile
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.post("/files/")
|
|
async def create_file(
|
|
file: Annotated[bytes, File()],
|
|
fileb: Annotated[UploadFile, File()],
|
|
token: Annotated[str, Form()],
|
|
):
|
|
return {
|
|
"file_size": len(file),
|
|
"token": token,
|
|
"fileb_content_type": fileb.content_type,
|
|
}
|