I'd like to be able to display a message to the user after a download is triggered via send_from_directory.
@app.route('/downloadFile', methods=['GET'])
def download():
return send_from_directory(output_directory, "myfile.txt", as_attachment=True)
This will trigger a download after the /downloadFile endpoint is visited, but in addition to the download being triggered, I'd like to have output in the browser that says something like "file download triggered". Is there a way to achieve this? If I wasn't using send_from_directory, I could do something like this to return some JSON return {'Status': 'file download triggered'}
I'm looking for a way to combine the two, that way the user doesn't see a blank screen when they hit this endpoint.