mirror of
https://github.com/fastapi/fastapi.git
synced 2026-11-21 10:13:53 +08:00
16 lines
336 B
Python
16 lines
336 B
Python
from typing import Annotated
|
|
|
|
from fastapi import FastAPI, Form, UploadFile
|
|
from pydantic import BaseModel
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
class Profile(BaseModel):
|
|
name: str
|
|
|
|
|
|
@app.post("/profiles/")
|
|
async def create_profile(profile: Annotated[Profile, Form()], avatar: UploadFile):
|
|
return {"profile": profile, "filename": avatar.filename}
|