I am trying to send multiple file uploads to a function app (http trigger). The http trigger code is below,
app = func.FunctionApp(http_auth_level=func.AuthLevel.ADMIN)
@app.route(route="test_http_trigger", auth_level=func.AuthLevel.ADMIN)
def test_http_trigger(req: func.HttpRequest) -> func.HttpResponse:
try:
if list(req.files.values())[0].filename.split('.')[-1] == 'zip':
logging.info(req.files.values())
return func.HttpResponse(str(req.files.values()), mimetype="text/html")
elif list(req.files.values())[0].filename.split('.')[-1] == 'txt':
logging.info(req.files.values())
return func.HttpResponse(str(req.files.values()), status_code=200, mimetype="application/json")
else:
return func.HttpResponse('0')
except Exception as e:
return func.HttpResponse(f"Internal server error: {e}", status_code=500)
I tried to send multiple files as input using the curl command below,
curl -X POST http://localhost:7071/api/test_http_trigger -F "[email protected]" -F "[email protected]"
This only processes the first file sent. I would like to know the right way to send multiple files to function app.
Thanks,