MCPcopy Create free account
hub / github.com/PacktPublishing/Full-Stack-FastAPI-React-and-MongoDB / upload

Function upload

chapter3/chapter3_upload.py:7–15  ·  view source on GitHub ↗
(picture:UploadFile=File(...), brand:str=Form(...), model:str=Form(...))

Source from the content-addressed store, hash-verified

5
6@app.post("/upload")
7async def upload(picture:UploadFile=File(...), brand:str=Form(...), model:str=Form(...)):
8
9 with open("saved_file.png", "wb") as buffer:
10 shutil.copyfileobj(picture.file, buffer)
11 return {
12 "brand": brand,
13 "model": model,
14 "file_name":picture.filename
15 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected