“Flask Unduh file” Kode Jawaban

cara membuat file yang dapat diunduh dalam 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) 
Salo Hopeless

Flask Unduh 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) 
Clasher

Jawaban yang mirip dengan “Flask Unduh file”

Pertanyaan yang mirip dengan “Flask Unduh file”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya