Debian Codegraph @

docs_src/request_forms_and_files/tutorial001_py310.py

raw
1 from fastapi import FastAPI, File, Form, UploadFile
2
3 app = FastAPI()
4
5
6 @app.post("/files/")
7 async def create_file(
8 file: bytes = File(), fileb: UploadFile = File(), token: str = Form()
9 ):
10 return {
11 "file_size": len(file),
12 "token": token,
13 "fileb_content_type": fileb.content_type,
14 }