1 /** 2 * 3 * @param file 4 * @return 5 */ 6 @PostMapping(value = "getCategoryByUserName") 7 public String updateConfig(@RequestParam("file") MultipartFile file) throws IOException { 8 // 图片存储路径 9 String path = "C:\\Project\\test01\\src\\main\\resources\\static\\ArticleImage\\"; 10 // 判断是否有路径 11 if (!new File(path).exists()) { 12 new File(path).mkdirs(); 13 } 14 String fileName = System.currentTimeMillis() + ".jpg"; 15 file.transferTo(new File(path+fileName)); 16 return path+fileName; 17 }
标签:String,File,fileName,图片,file,new,path,接收,springboot From: https://www.cnblogs.com/lwl80/p/16860080.html