response.setContentType("application/x-msdownload");
response.setHeader("Accept-Ranges", "bytes");
response.setHeader("Content-Length", String.valueOf(size));
response.setHeader("Content-Disposition", "attachment; fileName=" + URLEncoder.encode(name, "UTF-8"));

关键代码

response.setHeader("Accept-Ranges", "bytes");
response.setHeader("Content-Length", String.valueOf(size));

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注