I have a .txt
file on my directory. I just need a Button on my HTML page to download this file for the user.
I came up with this code, but the problem is when I click submit
in my HTML page nothing happens and there are no errors. But the file is not being downloaded.
<form method="GET">
<input type="submit">
</form>
My code in Flask
@app.route('/return-files', methods=['GET'])
def return_file():
return send_from_directory(directory='Users/Desktop/Python/', filename='myFile.txt', as_attachment=True)
Note: I checked all the questions on Stack overflow. Most of them put the file in the static folder before downloading or others who I did not understand what they are doing because they did not show what to do in HTML part