81,094
社区成员
发帖
与我相关
我的任务
分享
public static boolean fileUp(String path,MultipartFile file){
try {
InputStream stream = file.getInputStream();
OutputStream bos = new FileOutputStream(path);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
bos.write(buffer, 0, bytesRead);
}
bos.close();
stream.close();
return true;
} catch (FileNotFoundException e) {
return false;
} catch (IOException e) {
return false;
}
}