Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flask download box

I'm trying to make a button that will show the "Save as" download box. The images that I want to offer for download are not in the static folder, nor they will be. Using flask.send_file works by opening the file in the browser.

How can I use send.file in order to bring the download box up, without submitting the page (without changing the current page)?

like image 508
Mihai Neacsu Avatar asked Feb 24 '26 02:02

Mihai Neacsu


1 Answers

Look into the as_attachment option in send_file:

http://flask.pocoo.org/docs/api/#flask.send_file

Here's a somewhat related question:

Content-Disposition:What are the differences between "inline" and "attachment"?

like image 80
ubik Avatar answered Feb 25 '26 18:02

ubik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!