app = FastAPI()
@app.post("/processfile/")
async def process_file(file: UploadFile, filetag: int):
return {"filename": file.filename, "filetag": filetag}
@app.get("/")
async def main():
content = """
<body>
<form action="/processfile/" enctype="multipart/form-data" method="post" id="form1">
<label for file>Choose PDF:</label>
<input name="file" type="file" form="form1">
<br><br>
<label for filetag>Tag:</label>
<input name="filetag" id="filetag" type="number" form="form1" placeholder="1">
<br><br>
<input type="submit">
</form>
</body>
"""
return HTMLResponse(content=content)
Hello, I want the arguments filetag
, to be passed to function process_file
through HTMLResponse
, but via this code only the file
argument is passed
Could you please tell me where I am wrong?