src/main/java/com/jmsoftware/datastructuresandalgorithms/common/util/FileUtil.java
/**
     * Convert multipart file to file
     *
     * @param multipartFile multipart file
     * @return file
     * @throws IOException IO exception
     */
Convert multipart file to file
@param multipartFile multipart file
@return file
@throws IOException IO exception
Convert multipart file to file @param multipartFile multipart file @return file @throws IOException IO exception
public static File convertFrom(final MultipartFile multipartFile) throws IOException {
        log.info("Converting multipart file, original multipart file name: {}", multipartFile.getOriginalFilename());
        var convertFile = new File(Objects.requireNonNull(multipartFile.getOriginalFilename()));
        var fos = new FileOutputStream(convertFile);
        fos.write(multipartFile.getBytes());
        fos.close();
        return convertFile;
    }
public static File convertFrom ( final MultipartFile multipartFile ) throws IOException { log . info ( "Converting multipart file, original multipart file name: {}" , multipartFile . getOriginalFilename ( ) ) ; var convertFile = new File ( Objects . requireNonNull ( multipartFile . getOriginalFilename ( ) ) ) ; var fos = new FileOutputStream ( convertFile ) ; fos . write ( multipartFile . getBytes ( ) ) ; fos . close ( ) ; return convertFile ; }
Convert multipart file to file
 @param multipartFile multipart file
 @return file
 @throws IOException IO exception
Convert multipart file to file @param multipartFile multipart file @return file @throws IOException IO exception