| | |
| | | package com.whyc.util; |
| | | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.net.URLEncoder; |
| | |
| | | } |
| | | } |
| | | |
| | | public static String saveFile(MultipartFile multipartFile,String fileName) throws IOException { |
| | | String rootFile = CommonUtil.getRootFile(); |
| | | |
| | | String filePath = rootFile + fileName; |
| | | File file = new File(filePath); |
| | | File parentFile = file.getParentFile(); |
| | | if(!parentFile.exists()){ |
| | | parentFile.mkdirs(); |
| | | } |
| | | //存储 |
| | | multipartFile.transferTo(file); |
| | | |
| | | return "doc_file"+fileName; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | File file = new File("C:\\Users\\29550\\Desktop\\当前项目\\202207泰州平台"); |
| | | List list = new ArrayList<>(); |