java - How to check that file content really image - Stack Overflow
You'll see that MediaType
has a getType()
and a getSubtype()
method. What you are looking for is the type (ie. "image/*"
). The sub-type in this case would be "jpeg"
.
So your test should be:
if (mediaType.getType().equals("image")) { // Deal with image }
Read full article from java - How to check that file content really image - Stack Overflow
No comments:
Post a Comment