如何使用asp.net下载文件? [英] How to Download files using asp.net?

查看:91
本文介绍了如何使用asp.net下载文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在开发一个项目,用户可以在其中上传和下载文件.我完成了上传选项,并显示了上传到服务器的文件名.

现在,如果用户需要这些文件,则他可以下载所选文件(最近上传).我不知道如何下载这些文件及其内容.
我需要放置一个下载链接,是否可以在asp.net中下载这些文件?

Hi,

I am developing a project where, the user can upload and download the files. I completed the upload option and displayed the file name which is uploaded to the server.

Now, if user need those files, then he can able to download the selected file (which is uploaded recently). I don''t know how to download those files and its contents.
I need to put a download link, it is possible to download those files in asp.net?

Could anybody help me plz?

推荐答案

下载文件本身很简单:只需在网页上放置指向该文件的链接即可.
如果您将它们存储在数据库或zip中,则稍微复杂一些-但不是很多.

但是,如果它们作为文件存在,则只需要一个链接.
Downloading files themselves is simple: just put a link to the file on the web page.
If you have stored them in a database, or a zip it''s slightly more complex - but not a lot.

But if they are there as files, a link is all you need.


如果您在文件夹中有文件,请尝试使用简单的链接,例如:
if you are having a file in folder trhen try using simple link as:
<a href="../../Content/ExamPapers/Question.txt" target="_blank">Paper1</a>


在此处检查 [

这篇关于如何使用asp.net下载文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆