how to import download file in flask code example
Example 1: how to make downloadable file in flask
from flask import Flask
from flask import send_file
app = Flask(__name__)
@app.route('/download')
def downloadFile ():
path = "/Examples.pdf"
return send_file(path, as_attachment=True)
if __name__ == '__main__':
app.run(port=5000,debug=True)
Example 2: Flask Download a File
from flask import Flask
from flask import send_file
app = Flask(__name__)
@app.route('/download')
def downloadFile ():
path = "/Examples.pdf"
return send_file(path, as_attachment=True)
if __name__ == '__main__':
app.run(port=5000,debug=True)