Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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) 
Comment

Flask Download a File

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) 
Comment

PREVIOUS NEXT
Code Example
Python :: python listdir with full paths 
Python :: clear terminal in python 
Python :: python remove last character from string 
Python :: how to program 
Python :: generate a color python 
Python :: get current date in python 
Python :: checking django version 
Python :: python gui programming using pyqt5 
Python :: timeout exception in selenium python 
Python :: create guid python 
Python :: how to select all but last columns in python 
Python :: spacy en_core_web_sm error 
Python :: Write a line to a text file using the write() function 
Python :: python regex count matches 
Python :: Can only use .dt accessor with datetimelike values 
Python :: python check if variable is iterable 
Python :: linux ubuntu install python 3.7 
Python :: convert pandas datetime to day, weekday, month 
Python :: export pandas dataframe as excel 
Python :: put comma in numbers python 
Python :: python bytes to dict 
Python :: wait function python 
Python :: python capitalize each word 
Python :: python get date file last modified 
Python :: dislike_count 
Python :: plot specific columns pandas 
Python :: supprimer fichier pythpn 
Python :: connect postgresql with python sqlalchemy 
Python :: pyyaml install 
Python :: list all virtualenv in python 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =