from fastapi import FastAPI,Form,File,UploadFile
import uvicorn
app = FastAPI()
@app.post("/D2Vuploadfiles/")
async def postlistfiles(files:List[UploadFile]=File(...)):
for f in files:
do somethin
return {"status":status,"results":ret_list}
if __name__ == "__main__":
uvicorn.run(app,host='0.0.0.0',port=8000)
When I ran the above code, everything was OK.
And then I go to http://192.168. *. * / docs to testing the API. I found that when I added two files, the firtst test was successful.
Then I press the remove button after the first file to remove the first file.
It shows that only the second file is is still on the page.
However, the API runs for the first file. Is this a bug or is my code wrong?
But when I press the run button again after that, the API runs for the first file.
Is this a bug or is my code wrong?
@yhfwww can you edit your code with proper formatting?
"ret_list" where is this variable defined?
Is it inside the api or out the apis(globally)?
is it working the same way after restarting the server?
Most helpful comment
@yhfwww can you edit your code with proper formatting?