/**
* 获取上传文件的md5
*
* @param file
* @return
* @throws NoSuchAlgorithmException
* @throws IOException
*/
public String getMd5(MultipartFile file) {
try {
byte[] uploadBytes = file.getBytes();
MessageDigest md5 = MessageDigest.getInstance("MD5");
byte[] digest = md5.digest(uploadBytes);
String hashString = new BigInteger(1, digest).toString(16);
return hashString;
} catch (Exception e) {
LogUtil.writeErrorLog(e.toString(), e);
}
return null;
}