MultipartFile转File

 

public static void convert(MultipartFile multipartFile) {
        File file = null;
        try {
            String originalFilename = multipartFile.getOriginalFilename();
            String[] filename = originalFilename.split("\\.");
            file = File.createTempFile(filename[0], filename[1]);
            multipartFile.transferTo(file);
            file.deleteOnExit();
        } catch (IOException e) {
            e.printStackTrace();
        }
     return file; }

 

上一篇:springboot上传下载


下一篇:FL Studio20.8中文版安装体验试用下载 国产fl水果支持最新中文