lundi 20 novembre 2017

Multiple Files Download

i had the following code to download file(s)

var link = document.createElement("a");

link.setAttribute('download', null);
link.style.display = 'none';
document.body.appendChild( link );
response.forEach(function(download){
    link.setAttribute( 'href', download.link );
    link.setAttribute( 'download', download.filename );
    link.click();
});
document.body.removeChild( link );

however, i only able to initiate the download of 1 file, it suppose to have 2 files. The array response has the following attribute:

{ link: 'http://ift.tt/2zPUc6l', filename: 'file1.txt'} { link: 'http://ift.tt/2Af21D6', filename: 'file2.txt'}

Thanks




Aucun commentaire:

Enregistrer un commentaire