mirror of
https://github.com/rjNemo/fastapi
synced 2026-06-06 18:46:40 +00:00
* ✨ Add support for UploadFile annotations * 📝 Update File upload docs with FileUpload class * ✅ Add tests for UploadFile support * 📝 Update UploadFile docs
14 lines
326 B
Python
14 lines
326 B
Python
from fastapi import FastAPI, File, Form, UploadFile
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.post("/files/")
|
|
async def create_file(
|
|
file: bytes = File(...), fileb: UploadFile = File(...), token: str = Form(...)
|
|
):
|
|
return {
|
|
"file_size": len(file),
|
|
"token": token,
|
|
"fileb_content_type": fileb.content_type,
|
|
}
|