class FileUtils {

    public static void copyFile(MultipartFile file, String destFilename) {
        try {

            File destFile = new File(destFilename);
            File destParentDir = new File(destFile.getParent());

            if (!destParentDir.exists()) {
                org.apache.commons.io.FileUtils.forceMkdir(destParentDir);
            }

            Files.copy(file.getInputStream(), Paths.get(destFilename));
        } catch (IOException e) {
            logger.error("failed to copy file , {} is empty file", file.getOriginalFilename(), e);
        }
    }

}