Bottom Page

Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Download multiple images with one click
Hey guys, I've solve my last problem with help from @perfringo ! (

Now I've got into another problem. How do I download multiple images with just one click ? In html. I'm creating a web app based on flask.

So my file is looking like this :

from flask import Flask, jsonify, render_template, request
app = Flask(__name__)

def index():
    return render_template('index.html')

@app.route('/generate', methods=['GET'])
def generate():
    prefix = request.args.get('prefix')
    urls = []
    for number in range(1, 7):
        urls.append('{p}-{n}.jpg'.format(p=prefix, n=number))
    return jsonify(result=urls)
and my index.html is looking like this :

<!doctype html>
<html lang="en">
<title>Image Grabber v1.0</title>
<script src=''></script>
<script type=text/javascript>
$SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
$( document ).ready(function() {
$('#download').bind('click', function() {
$.getJSON($SCRIPT_ROOT + '/generate', {
prefix: $('input[name="prefix"]').val()
}, function(data) {
return false;
<h2>Image Grabber v1.0</h2>
<p><input type=text size=45 name=prefix>
<span id=result></span>
<p><button type="submit" id=download>Download</button></p>

So the user will input a code, and the form will generate 6 urls. Now I have no idea how to download them all using Javascript and jquery or something else. Any help is appreciated.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Why is left mouse click not working? yeto 3 163 Jul-15-2019, 05:23 AM
Last Post: Yoriz
  How to get mouse coordinates on click and release OhNoSegFaultAgain 1 184 May-17-2019, 06:56 PM
Last Post: buran
  o365 special subject mail download issue anna 3 228 May-16-2019, 07:16 PM
Last Post: micseydel
  Openpyxl - When save existing xlsx sheet, images/drawing does not get saved shubhamjainj 2 423 Apr-16-2019, 07:09 AM
Last Post: shubhamjainj
  can i get any xpath on click event? Prince_Bhatia 3 297 Apr-09-2019, 01:32 PM
Last Post: Larz60+
  Putting text on images from excel/csv file sam77am 1 217 Apr-05-2019, 07:36 AM
Last Post: Larz60+
  Mass load images Linuxdesire 1 214 Mar-29-2019, 06:24 PM
Last Post: Larz60+
  Automate the calculus of NDVI index on a 100 images yassine01 0 175 Mar-27-2019, 12:13 PM
Last Post: yassine01
  How to get python to download YouTube videos in the background? Pythenx 11 756 Mar-25-2019, 04:57 AM
Last Post: samsonite
  Download multiple large json files at once halcynthis 0 256 Feb-14-2019, 08:41 AM
Last Post: halcynthis

Forum Jump:

Users browsing this thread: 1 Guest(s)