dimanche 1 mars 2015

Download file from signed S3 url on click

I have a signed Amazon S3 URL which points to a PDF file in a bucket


I want to download this file, not redirect/display it, when a button is clicked.


I had figured something like this



Router.route('download', {
path: '/d/:signedURL',
onAfterAction: function() {
var req = this.request;
var res = this.response;

res.setHeader('Content-disposition', 'attachment; filename=' + this.params.signedURL);

console.log(req, res);


}
}, {where: 'server'});


But can't get it to work, any advice?


Aucun commentaire:

Enregistrer un commentaire