无论怎么认知,用迅雷下和IE8下下载 都是出现*.action文件,不能正常出现下载文件名和类型。
[code]public InputStream getDownLoadFile() throws FileNotFoundException {
this.setFile();
String realPath = ServletActionContext.getRequest().getRealPath(
"/upload");
InputStream inputStream = new FileInputStream(realPath+"/"+this.file);
return inputStream;
}[/code]
在downloadAction中 代码如上
在下载端头文件如下:
Server Apache-Coyote/1.1
Content-Disposition attachment;file="2.jpg"
Content-Type application/octet-stream;charset=ISO8859-1
Transfer-Encoding chunked
Date Sun, 09 May 2010 11:33:59 GMT
struts.xml配置文件如下:
[code="java"]
downLoadFile
application/octet-stream;charset=ISO8859-1
attachment;file="${file}"
[/code]
能正常下载,为什么会这样呢?求朋友们给个答案。