1

This is what i have tried but got an errorerror message

@app.post('/register') async def register_kamwali(user: UserModel, image: UploadFile = File(...)): print(image.filename) data = {"password": user.password, "firstname": user.firstname, "lastname": user.lastname} db.child("Users").child(user.username).set(data); db.push(data) return {"user added successfully !!"}

  • 2
    You're not asking FastAPI to parse formdata (which would be `fieldname: type = Form(...)`), you're trying to have both a JSON body (`user: UserModel`) and a FormData at the same time - which won't work. – MatsLindh Nov 20 '22 at 21:36

0 Answers0