Using Tika for mime type detection gives unexpected results

I am using Tika for detecting mime type by using this code

InputStream inputStream = file.getInputStream();
Tika tika = new Tika();
String mediaType= tika.detect(inputStream);

Now when I am uploading a doc file it is detecting it's mediatype as application/xhtml+xml , Although it should have detect it as application/msword , This is happening with some doc file only not all of them

链接地址: http://www.djcxy.com/p/45484.html

上一篇: 限制名称大小和文件扩展

下一篇: 使用Tika进行MIME类型检测会带来意想不到的结果