0

I've seen this question How can I create download link in html?. One solution to create a link for download is using this <a href="link/to/your/download/file" download="filename">Download link</a>. However, if the data source is mongodb, what href should be set?

Community
  • 1
  • 1
Coding_Rabbit
  • 1,125
  • 3
  • 17
  • 41

1 Answers1

0

You have to give the path of the file where it's available in the database. Let's say your file is http://www.w3schools.com/images/myw3schoolsimage.jpg so in the response where you have to return the location you can put

<a href="http://www.w3schools.com/images/myw3schoolsimage.jpg" download> [<img border="0" src="https://i.stack.imgur.com/S7CZv.jpg" alt="W3Schools" width="104" height="142">][1]

tripleee
  • 158,107
  • 27
  • 234
  • 292
Gayathri Mohan
  • 2,836
  • 4
  • 18
  • 24