获取文件名及后缀信息:
MultipartFile file = new MultipartFile();String file = file.getOriginalFilename()
获取文件名:
MultipartFile file = new MultipartFile();String fileName = file.getOriginalFilename().substring(0,file.getOriginalFilename().lastIndexOf("."))
获取文件后缀:这个后缀带‘.’如:.zip,如果不想带‘.’这样即可lastIndexOf(".")+1
MultipartFile file = new MultipartFile();String fileSuffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."))
获取文件类型:
MultipartFile file = new MultipartFile();String fileType = file.getContentType()
获取文件大小:
MultipartFile file = new MultipartFile();String fileSize = file.getSize()
来源地址:https://blog.csdn.net/lixuepeng1102/article/details/128952723