MultipartFile的属性(getOriginalFilename(),getName(),getResource(),getBytes(),getSize())
上传文件是116.jpg
@PostMapping("/test")
public R uploadFile1(MultipartFile file) throws IOException {
System.out.println("file.getOriginalFilename() = " + file.getOriginalFilename()); //116.jpg
System.out.println("file.getName() = " + file.getName()); //file
System.out.println("file.getContentType() = " + file.getContentType()); //image/jpeg
System.out.println("file.getResource() = " + file.getResource()); //MultipartFile resource [file]
System.out.println("file.getBytes() = " + file.getBytes()); //[B@4a75acdd
System.out.println("file.getSize() = " + file.getSize()); //10059
return R.ok();
}
结果:
欢迎一起来学习和指导,谢谢关注!
本文来自博客园,作者:xiexie0812,转载请注明原文链接:https://www.cnblogs.com/mask-xiexie/p/16590811.html