//设置Content-Disposition
response.setHeader("Content-Disposition", "attachment;filename="+docName);
//读取文件
InputStream in = new FileInputStream(fullFileName);
OutputStream outs = response.getOutputStream();
//写文件
int b;
while((b=in.read())!= -1)
{
outs.write(b);
}
in.close();
outs.close();
时间: 2024-09-30 18:35:26