I want to download my file that has been generated with res.download.
I'm passing variable filename and path like this :
window.location.href = "/transaction/api/downloadfile?filename="+res.filename;
}, 3000);
And here is my code to download file in routes.
router.get("/api/downloadfile", function (req, res) {
console.log(req.query.filename);
res.download(req.query.filename);
res.render("pages/Admin/PO/createpo");
});
Please help me for this issue :)
Thank you everyone.