I read that Files.probeContentType(path) can be used to get the file type of a file without relying on file extensions. However in my case, if I remove the file type, the function returns the file type "null". If I attach the correct extension, then I get the type as "image/jpeg". Can anyone what is going on here or is my understanding of probeContentType not correct? I'm expecting it to return "image/jpeg" irrespective of the fact that it has file extension or not.
This is the case where I deliberately removed the extension from the file "Nature.jpg":
Update Using org.apache.tika (v2.4)
Tika tika = new Tika();
String myType = tika.detect(filePath);
If the file extension is not present I get the filetype as "application/octet-stream". The image is originally jpeg so I was expecting it to detect it as an image.
