上传时后台获取图片大小方法

MultipartFile multipartFile = request.getFile("files[]");
 BufferedImage bi =ImageIO.read(multipartFile.getInputStream()); if((bi.getWidth()>1080||bi.getHeight()>1920)){ throw new Exception("像素太大"); }

猜你喜欢

转载自z63as.iteye.com/blog/2315261