如何上传文件以及如何从文件夹下载. [英] How to upload a file and how to download from folder.
本文介绍了如何上传文件以及如何从文件夹下载.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何上传文件以及如何从文件夹下载?
How to upload a file and how to download from folder?
推荐答案
看看这些 ^ ]结果.
设计页面
<asp:FileUpload ID="flUpload" runat="server" />
背后的代码
Code behind
protected void submit_Click(object sender, ImageClickEventArgs e)
{
string ID=textbox1.text;
flUpload.SaveAs(Server.MapPath("user_doc/" + ID + ".doc"));
}
假设这是ASP,然后在页面上放置FileUpload控件,并处理OnClick事件:
Assuming this is ASP, then place a FileUpload control on your page, and handle the OnClick event:
string filename = Path.GetFileName(MyFileUpload.FileName);
MyFileUpload.SaveAs(Mypath + filename);
要下载该文件,只需在您的网页顶部添加一个文件链接-其余的将由客户端浏览器完成.
To download it, just add a link to the file top your web page - the client browser will do the rest.
这篇关于如何上传文件以及如何从文件夹下载.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文