Commit 8341a4adde5d7eb0c03266d7b34b867dce592ece
1 parent
fb0cf9d4
2
Showing
1 changed file
with
2 additions
and
2 deletions
src/main/java/com/bsth/controller/DownloadController.java
| @@ -37,8 +37,8 @@ public class DownloadController | @@ -37,8 +37,8 @@ public class DownloadController | ||
| 37 | File file=new File(moudelPath); | 37 | File file=new File(moudelPath); |
| 38 | HttpHeaders headers = new HttpHeaders(); | 38 | HttpHeaders headers = new HttpHeaders(); |
| 39 | String realFileName=new String(fileName.getBytes("UTF-8"),"iso-8859-1");//为了解决中文名称乱码问题 | 39 | String realFileName=new String(fileName.getBytes("UTF-8"),"iso-8859-1");//为了解决中文名称乱码问题 |
| 40 | - headers.setContentDispositionFormData("attachment", URLDecoder.decode(realFileName,"utf-8")); | ||
| 41 | - System.out.println(realFileName); | 40 | + headers.setContentDispositionFormData("attachment", fileName); |
| 41 | + System.out.println( URLDecoder.decode(realFileName,"utf-8")); | ||
| 42 | headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); | 42 | headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); |
| 43 | return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file), | 43 | return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file), |
| 44 | headers, HttpStatus.CREATED); | 44 | headers, HttpStatus.CREATED); |