通过spring-content-jpa自定义上传文件验证

时间:2018-06-16 10:40:36

标签: spring-data

有时你需要,上传验证或不上spring-content-jpa依赖。 但我无法验证上传的文件。

我的验证码就是这样,

if (!(product.getMimeType().contains(".jpeg")||product.getMimeType().contains(".jpg")||
                product.getMimeType().contains(".png"))||product.getMimeType().contains(".gif")) {
            errors.rejectValue("mimeType", null, "Please upload a valid image.");

        }

我正在使用org.springframework的验证器接口。 如何解决这个问题?

0 个答案:

没有答案