就这么写就行
MultipartFile multipartFile = multipartHttpServletRequest.getFile("file");
String originalFilename = multipartFile.getOriginalFilename();
// Check for Unix-style path
int unixSep = originalFilename.lastIndexOf('/');
// Check for Windows-style path
int winSep = originalFilename.lastIndexOf('\\');
// Cut off at latest possible point
int pos = (winSep > unixSep ? winSep : unixSep);
if (pos != -1) {
// Any sort of path separator found...
originalFilename = originalFilename.substring(pos + 1);
}