把代码拿出来给我们看看
phyFile = new File(filePath);
FileInputStream fin = new FileInputStream(phyFile);
OutputStream outStream = response.getOutputStream();
String fullFileName = file.getFullFileName();
// String contentType ="application/x-msdownload";
// "application/unknown";//不管什么文件类型均提示下载
log.debug(CONTENT_TYPE+"
"+fullFileName+"
"+phyFile.length());
response.setContentType(CONTENT_TYPE);
response.setHeader("Content-Disposition", "attachment;filename=/""+fullFileName+"/""
;
response.setHeader("Content-length", String.valueOf(phyFile.length()));
byte[] info = new byte[1000];
int len;
while((len=fin.read(info))>0) {
outStream.write(info, 0, len);
}
fin.close();