11.1、文件下载概述
1、将响应的内容类型设置为文件的内容类型。标头Content-type用来规定实体主体中的数据类型,包含媒体类型和子类型标识符。
2、添加一个名为Content-Disposition的HTTP响应头,给它赋值attachment;filename=filename,这里的fileName是指在文件下载对话框中显示出来的默认文件名。它通常与文件名相同,但是也可以不同。
...
分类:
其他好文 时间:
2014-08-26 19:42:56
阅读次数:
217
public function test(){ header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:attachment;filename=export_dat...
分类:
Web程序 时间:
2014-08-26 17:10:26
阅读次数:
700
@RequestMapping(value="ddd.do")publicvoidddd(HttpServletResponseresponse){try{List<AsWp>list=asWpService.findAll();HSSFWorkbookwb=export(list);response.setContentType("application/vnd.ms-excel");response.setHeader("Content-disposition","p_w_upload;fil..
分类:
编程语言 时间:
2014-08-24 10:22:22
阅读次数:
213
Content-Disposition的使用和注意事项最近不少Web技术圈内的朋友在讨论协议方面的事情,有的说web开发者应该熟悉web相 关的协议,有的则说不用很了解。个人认为这要分层次来看待这个问 题,对于一个新手或者刚入门的web开发人员而言,研究协议方面的东西可能会使得web开发失去趣味性、...
分类:
其他好文 时间:
2014-08-21 16:50:14
阅读次数:
192
HTMLPage1.htm页
下载
下载Handler1.ashx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebApplication3
{
///
/// 下载Handler1 的摘要...
分类:
其他好文 时间:
2014-08-13 14:59:56
阅读次数:
470
PHP怎么实现网站保存快捷方式
<?php
$Shortcut = "[InternetShortcut]
URL=http://blog.csdn.net/phpfenghuo/
IDList = [{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2";
Header("Content-type: application/octet-stream");
header("Content-Disposition: attachme...
分类:
Web程序 时间:
2014-08-11 00:32:11
阅读次数:
305
Response.AddHeader使用实例1.文件下载,指定默认名Response.AddHeader("content-type","application/x-msdownload"); // 限制类型Response.AddHeader("Content-Disposition","atta...
分类:
其他好文 时间:
2014-08-07 22:42:55
阅读次数:
272
<?php/*//下载$filename = 'av.zip';// 设置类型:可以省略// header("content-type:image/jpeg");//设置文件为附件header("content-disposition:attachment;filename=".$filename)...
分类:
其他好文 时间:
2014-07-22 23:18:47
阅读次数:
281
在通过response导出文件数据的时候,不论是txt还是Excel,如果想让其文件名称为中文,解决方案:response.setCharacterEncoding("UTF-8");response.setContentType("application/txt");//“application/vnd.ms-excel”response.setHeader("Content-disposition","p_w_upload;fi..
分类:
其他好文 时间:
2014-07-17 09:21:52
阅读次数:
221
WritableWorkbook out = null;
try {
response.getServletResponse().reset();
((HttpServletResponse) response.getServletResponse()).setHeader("Content-Disposition", "attachment;filename=export....
分类:
编程语言 时间:
2014-07-14 18:06:14
阅读次数:
345