下载的时候用到的文件的设置

在做文件下载的时候用到的文件的设置

 

1.response.setContentType设定输出类型:

 

HTML format (.htm or .html): text/html
Adobe Portable Document (pdf): application/pdf
Microsoft Word (.doc): application/msword
Microsoft Excel (.xls): application/msexcel
Microsoft Powerpoint (.ppt): application/ms-powerpoint
Realaudio (.rm, .ram): audio/x-pn-realaudio
Text format (.txt): text/txt
Zipped files (.zip): application/zip

 

response.setContentType( "application/msword" );
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-type","application/pdf");

 

2.设定输出头

response.setHeader("Content-disposition", "attachment; filename="+fileName);

attachment为附件打开

inline为在线打开

你可能感兴趣的:(html,Microsoft,Excel,Adobe)