0

As i saw in some threads, i may download a file that way:

$('.download').click(function(){
     window.location.href = 'images/apple_juice.jpeg';
});

But instead i am getting a page presenting this image.

shmnsw
  • 639
  • 2
  • 11
  • 24

1 Answers1

1

For future reference, i have managed download using node.js:

backup.get('/download-backup-file&:file_name', function(req, res){

    var file_name = req.params.file_name.split('=')[1];
    var file = 'backups/'+file_name;
    res.download(file); // Set disposition and send it.

});
shmnsw
  • 639
  • 2
  • 11
  • 24