package com.jkcredit.sysnews.util; import lombok.extern.slf4j.Slf4j; import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.IOException; /** * @description: * @author: xusonglin * @create: 2020/3/1 0:54 * @version: V1.0 **/ @Slf4j public class UploadUtil { public static void upload(MultipartFile file, String path) throws IOException{ File dest = new File(path); if (!dest.getParentFile().exists()) { dest.getParentFile().mkdir(); } file.transferTo(dest); } }