Please help me to find out the type of the file which is being uploaded. I wanted to distinguish between excel type and csv.
MIMEType returns same for both of thes
I figured out a cheaper way of doing this with java.nio.file.Files
public String getContentType(File file) throws IOException {
return Files.probeContentType(file.toPath());
}
- or -
public String getContentType(Path filePath) throws IOException {
return Files.probeContentType(filePath);
}
Hope that helps.
Cheers.