问题描述
我必须在我的网站中提供一个选项来上传多个文件,然后允许用户下载这些文件.
我已经完成了多个文件的上传,但是我还不清楚如何下载部分.
我首先想到了将超链接动态地添加到每个文件的标签中(因为我不确定用户将上传多少个文件).
但是随后它在浏览器中打开文件,并且不提供保存或打开文件的选项.
主要问题是用户可以提交任何类型的文件,例如ms doc或xls或文本文件等,因此内容类型不固定.
我不清楚我将如何精确地实现,我的意思是动态添加链接按钮或动态添加超链接.之后,我将如何下载文件?我不能做
Response.WriteFile(Server.MapPath( @" 〜/logo_large.gif"解决方案
I have to give one option in my website to upload multiple files and then allowing users to download those files.
I have done uploading multiple files part, however I am not much clear how I will do downloading part.
I first thought to add hyperlinks dynamically to a label for each file (as I am not sure how many files user will upload).
But then it opens file in browser and does not give option to save or open file.
Main issue is user can submit any type of file like ms doc or xls or text files etc Hence content type is not fixed.
I am not clear on how exactly I will do it I mean adding link buttons dynamically or adding hyperlinks dynamically. And after that how will I download file? I am not able to do
Response.WriteFile(Server.MapPath(@"~/logo_large.gif"));as content type is not clear.
解决方案
这篇关于下载文件代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!