1,Http 协议中有专门的指令来告知浏览器, 本次响应的是一个需要下载的文件. 格式如下:Content-Disposition: attachment;filename=filename.ext以上指令即标记此次响应流是附件,且附件文件名为 filename.ext注意:(1): 中文文件名需要...
知识点: //获取用户要下载的资源的名称 string name=context.Request.Params["downloadName"]; //设置响应报文中,当前资源是一个附件,需要下载。 context.Response.AddHeader("Content-Disposition",.....
分类:
其他好文 时间:
2014-10-18 23:58:51
阅读次数:
286
经常可以看到点击一个文件,然后就可以下载。这个功能在php中实现可以通过下面的代码:if(is_file($file)){ header("Content-Type: application/force-download"); header("Content-Disposition: a...
分类:
Web程序 时间:
2014-09-28 02:02:20
阅读次数:
202
[csharp]
view plaincopyprint?
protected
void btn_ToExcel_Click(object sender, EventArgs e)
{ Response.ClearContent(); Response.AddHeader("content-disposition",
"attac...
分类:
Web程序 时间:
2014-09-26 06:29:18
阅读次数:
260
protected void Button1_Click(object sender, EventArgs e)
{
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls");
Respo...
分类:
Web程序 时间:
2014-09-19 12:00:55
阅读次数:
170
protected void btn_ToExcel_Click(object sender, EventArgs e)
{
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls");
R...
分类:
Web程序 时间:
2014-09-19 12:00:35
阅读次数:
219
从IIS或者Tomcat之类的Web服务器通过二进制流下载文件时(比如通过设置Header为Content-disposition:inline),如果被下载的文件是Office2007的dotx,docx,pot等后缀的时候,下载对话框中的图标会变成ZIP的,相应的文件名也会成为zip为扩展后缀的文件。其实出现这样的情况,是由..
分类:
其他好文 时间:
2014-09-12 02:28:43
阅读次数:
154
(一)文件下载,指定默认名Response.AddHeader("content-type","application/x-msdownload");Response.AddHeader("Content-Disposition","attachment;filename = 要下载的文件名.后缀名...
分类:
其他好文 时间:
2014-09-10 14:02:00
阅读次数:
201
一、作用: 1)希望某类或者某已知MIME类型的文件(比如:*.gif;*txt;*.htm)能够在访问时弹出"文件下载对话框" 2)希望客户端下载时以指定文件名显示 3)希望某文件直接显示而不是弹出文件下载对话框二、使用语句: response.setHeader("Content-dis...
分类:
其他好文 时间:
2014-09-06 09:40:52
阅读次数:
215
function outputCsv($data, $filename = 'file.csv') {//输出文件,下载文件 header('Content-Type:application/force-download'); header("content-Disposition:filename...
分类:
Web程序 时间:
2014-08-27 12:32:57
阅读次数:
191