社区
.NET技术前瞻
帖子详情
在.net中如何写文件上传下载代码
bjsummer123
2010-12-08 05:24:08
想要在页面中实现文件上传下载功能,哪位大师可以帮帮忙啊
...全文
77
4
打赏
收藏
在.net中如何写文件上传下载代码
想要在页面中实现文件上传下载功能,哪位大师可以帮帮忙啊
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
wuyq11
2010-12-08
打赏
举报
回复
web fileupload
FileInfo Fi = new FileInfo(filePath);
if (Fi.Exists)
{
FileStream fs = new FileStream(filePath, FileMode.Open);
byte[] bytes = new byte[(int)fs.Length];
fs.Read(bytes, 0, bytes.Length);
fs.Close();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=1.excel");
Response.BinaryWrite(bytes);
Response.Flush();
Response.End();
}
string path = Server.MapPath("~/") + "";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(obj.Name, System.Text.Encoding.GetEncoding("utf-8")));
Response.ContentType = "application/octet-stream";
Response.WriteFile("" + path + "");
Response.End();
if (fileUpload.HasFile)
{
string savePath = Server.MapPath("~/upload/");
if(!System.IO.Directory.Exists(savePath))
{
System.IO.Directory.CreateDirectory(savePath);
}
savePath = savePath + "\\" + fileUpload.FileName;
fileUpload.SaveAs(savePath);
}
bjsummer123
2010-12-08
打赏
举报
回复
具体的代码怎么写啊,初学者 不太懂也
d563382384
2010-12-08
打赏
举报
回复
FileUpload 实现文件上传 .save方法保存上传的文件
keketian521
2010-12-08
打赏
举报
回复
帮顶下!!!!!!!!!!
.NET
文件上传
下载
系统源
代码
合集
.NET
文件上传
下载
系统源
代码
合集
asp
.net
多
文件上传
源
代码
asp
.net
中
多
文件上传
源
代码
例子
ASP
.NET
上传和
下载
文件的
代码
ASP
.NET
上传和
下载
文件的
代码
asp
.net
+flash批量上传源
代码
asp
.net
+flash批量上传源
代码
asp
.net
+flash批量上传源
代码
asp
.net
+flash批量上传源
代码
asp
.net
+flash批量上传源
代码
asp
.net
+flash批量上传源
代码
asp
.net
+flash批量上传源
代码
asp
.net
+flash批量上传源
代码
asp
.net
+...
asp
.net
文件上传
和
下载
设计
代码
文件上传
和
下载
文件上传
和
下载
文件上传
和
下载
.NET技术前瞻
13,347
社区成员
5,388
社区内容
发帖
与我相关
我的任务
.NET技术前瞻
.NET技术 .NET技术前瞻
复制链接
扫一扫
分享
社区描述
.NET技术 .NET技术前瞻
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章