mirror of
https://github.com/fastapi/fastapi.git
synced 2026-11-23 01:48:43 +08:00
14 lines
311 B
Python
14 lines
311 B
Python
from fastapi import FastAPI, File, Form, UploadFile
|
|
from pydantic import BaseModel
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
class Profile(BaseModel):
|
|
name: str
|
|
|
|
|
|
@app.post("/profiles/")
|
|
async def create_profile(profile: Profile = Form(), avatar: UploadFile = File()):
|
|
return {"profile": profile, "filename": avatar.filename}
|