how i can download a pdf file by click button? javascript
So i want to download a pdf file from a folder but i dont know how i can do it, since trying with something like doesnt work because it says that the page is not working
i know there is a attach parameter but i dont know how to handle it
await fs.rename(cvTempPath, targetPath_);
const newCv = cvUrl+extt
try {
const result = await cloudinary.v2.uploader.upload(`src/public/uploads/${newCv}`);
const cvSaved = await User.findByIdAndUpdate(req.user.id,{$set:{cvfilename:result.url}})
} catch (error) {
console.log(error)
}
<a class="button button-lg button-primary-outline" href="<%= user.cvfilename %>">Descargar CV</a>
0
-
Hi Jesus,
You should be able to use the `fl_attachment` flag as documented here in your URL.
For example, if you click on the link https://res.cloudinary.com/demo/image/upload/fl_attachment/long_multi_page_pdf, it will download automatically the PDF.
Hope that helps.
Best,
Loic
0
Post is closed for comments.
Comments
1 comment