/**
* @Description: 上传文件
* @Author: vdi100
* @CreateDate: 2019/4/17 11:14
* @Version: 1.0
*/
public static String SaveFileFromInputStream(MultipartFile file, String savePath) throws IOException
{
InputStream stream = file.getInputStream();
String fileName = file.getOriginalFilename();
String path = savePath + "/"+ fileName;// 文件保存地址
FileOutputStream fs = new FileOutputStream(path);
System.out.println("------------"+ savePath + "/"+ fileName);
byte[] buffer = new byte[1024*1024];
int bytesum = 0;
int byteread = 0;
while ((byteread = stream.read(buffer))!=-1)
{
bytesum += byteread;
fs.write(buffer,0,byteread);
fs.flush();
}
fs.close();
stream.close();
return path;
}