@GetMapping("/download")
    public void downloadFile(String filePath, HttpServletResponse response) throws IOException {
        byte[] bytes = fastDfsUtil.downloadFile(filePath);
        String fileName = "哈哈.jpg";
        //方式一
        // fileName=new String(fileName.getBytes(), "ISO8859-1")
        //方式二
        fileName = URLEncoder.encode(fileName, "utf-8");
        response.setHeader("Content-disposition", "attachment;filename=" + fileName);
        IOUtils.write(bytes, response.getOutputStream());
    }

相关文章:

  • 2021-12-17
  • 2021-10-24
  • 2021-11-19
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2022-02-01
  • 2022-12-23
猜你喜欢
  • 2021-11-23
  • 2021-11-23
  • 2021-08-21
  • 2022-02-06
  • 2022-12-23
  • 2021-12-22
  • 2021-08-18
相关资源
相似解决方案