附件下载
来源:互联网 发布:淘宝宝贝图尺寸 编辑:程序博客网 时间:2024/04/29 13:29
if (Request.QueryString["filepath"] != null)
{
string path = Request.QueryString["filepath"].ToString();
FileInfo fi = new FileInfo(path);//获取文件路径
string name = Request.QueryString["filename"];//获取附件原名
if (fi.Exists)//判断文件是否存在
{
//将文件保存到本机上
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(name));
Response.AddHeader("Content-Length", fi.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.Filter.Close();
Response.WriteFile(fi.FullName);
Response.End();
}
else
{
pubfun.Alert(Page, "您要下载的文件不存在!");
pubfun.RegisterStartupScript(Page, "PAGE", "window.location.href='" + "DownList.aspx?ChannelId=9';");
}
}
else
{
pubfun.Alert(Page, "请选择您要下载的文件!");
pubfun.RegisterStartupScript(Page, "PAGE", "window.location.href='" + "DownList.aspx?ChannelId=9';");
}
- 下载附件
- 附件下载
- 附件下载
- 附件下载
- 附件下载
- 附件下载
- asp.net 下载附件
- asp.net 下载附件
- Grails附件下载
- 中文名附件下载
- 中文名附件下载乱码
- Struts1 action 下载附件
- JSP附件下载功能
- mastudio 下载附件
- 附件上传、下载
- DownLoad下载附件事件
- 下载远程附件php
- wcm附件下载
- 嵌入式系统学习入门-UBOOT
- ASP .NET PHP 注入页面构造
- 附件的上传
- 移植wifi无线网卡到mini2440上全过程
- uboot环境变量与内核MTD分区关系
- 附件下载
- 注解联合主键
- ACE的陷阱
- 邮件
- 【百科】MATLAB
- 逆序数 时间复杂度O(nlgn)
- Java 线程 详解
- 英文seo发外链的方法技巧
- PHP magic_quotes_gpc的正确处理方式