base64前后台的加密与解密

前端 let filePath = base64.encode(path);

后台

 public AjaxResult export(String filePath) {
        log.info("需要删除的文件:{}", filePath);
        byte[] decode = Base64.getDecoder().decode(filePath);
        filePath = new String(decode);
        log.info("解密后的文件:{}", filePath);
        File file = new File(filePath);
        boolean result = false;
        if (file.exists()) {
            result = file.delete();
        }
        return result ? success("操作成名"):error("操作失败");
    }
原文地址:https://www.cnblogs.com/person008/p/15745977.html