管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-11-01 b1bdad2ff512e73a2dd9049f2ccbddd4634969f7
src/main/java/com/lf/server/helper/WebHelper.java
@@ -286,12 +286,15 @@
    /**
     * 下载文件
     *
     * @param file 文件
     * @param res  响应
     * @param file     文件
     * @param fileName 文件名
     * @param res      响应
     * @throws Exception 异常
     */
    public static void download(String file, HttpServletResponse res) throws Exception {
        String fileName = URLEncoder.encode(FileHelper.getFileName(file), "UTF-8");
    public static void download(String file, String fileName, HttpServletResponse res) throws Exception {
        if (StringHelper.isNull(fileName)) {
            fileName = URLEncoder.encode(FileHelper.getFileName(file), "UTF-8");
        }
        // 设置响应头中文件的下载方式为附件方式,以及设置文件名
        res.setHeader("Content-Disposition", "attachment; filename=" + fileName);