Answers for "How to make the file download website flask python"

2

how to make downloadable file in flask

from flask import Flask
from flask import send_file
app = Flask(__name__)

@app.route('/download')
def downloadFile ():
    #For windows you need to use drive name [ex: F:/Example.pdf]
    path = "/Examples.pdf"
    return send_file(path, as_attachment=True)

if __name__ == '__main__':
    app.run(port=5000,debug=True)
Posted by: Guest on March-26-2021

Code answers related to "How to make the file download website flask python"

Python Answers by Framework

Browse Popular Code Answers by Language