0%
  
  
    
    
  
  
  
    
    
      
      
    
    
      
      
    
    
      
      
    
      
    
    
    
    
          
2019.7.17
方法一
1 2 3 4 5 6 7 8 9 10 11
   | 	 	public void uploadUtil(MultipartFile,String filepath,String filename) throws IOException { 		File uploadDir = new File(filepath); 		if(!uploadDir.exists()) { 			uploadDir.mkdirs(); 		}	 		File servfile = new File(filepath+filename); 		file.transferTo(servfile); 	} transferTo(servfile); 	}
   | 
 
方法二
1 2 3 4 5 6 7 8 9 10 11
   |  	public void uploadUtil(byte[] file,String filepath,String filename) throws IOException { 		File uploadDir = new File(filepath); 		if(!uploadDir.exists()) { 			uploadDir.mkdirs(); 		} 		FileOutputStream outputStream = new FileOutputStream(filepath+filename); 		outputStream.write(file); 		outputStream.flush(); 		outputStream.close(); 	}
 
  | 
 
列表
图片
alt 博客图片