S
S
Shato Daltsaev2017-06-11 15:38:09
Flask
Shato Daltsaev, 2017-06-11 15:38:09

Why is Flask not downloading a file?

I'm trying to download a file from my application, but for some reason it doesn't work.

Here is my method

@admin.route('/download_doc', methods=['GET', 'POST'])
def download_doc():
    doc_id = request.json['id']
    doc = Doc.query.filter(Doc.id==doc_id).first()
    filename = doc.filename  
    return send_from_directory(app.config['UPLOAD_FOLDER'], filename, as_attachment=True)


UPLOAD_FOLDER = 'static\doc'
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER


Writes that the method worked 200. But the download of the file does not start. Help me to understand

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Kolesnichenko, 2017-06-11
@KolesnichenkoDS

Maybe because the backslash?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question