简体   繁体   English

如何在HTML中为mongodb数据创建下载链接?

[英]How can I create download link for mongodb data in HTML?

I've seen this question How can I create download link in html? 我已经看到了这个问题, 如何在html中创建下载链接? . One solution to create a link for download is using this <a href="link/to/your/download/file" download="filename">Download link</a> . 创建下载链接的一种解决方案是使用<a href="link/to/your/download/file" download="filename">Download link</a> However, if the data source is mongodb, what href should be set? 但是,如果数据源是mongodb,则应设置什么href

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 假设您的文件是http://www.w3schools.com/images/myw3schoolsimage.jpg,因此在响应中必须返回的位置可以放入

<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]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM