We have a file upload function, we need to check the file media type is as expected.
For example, if the file upload function only accept xls or xlsx file, other media type is disallowed.
How to do it?
Before cope with this problem, you need to add tika dependency in your pom.xml
Assume we will check some media types as bellows:
Here is the approach to check file media type:
Console looks like this: