We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Mime type finder

Is there a way to identify the mime type (in aspose total java ) of a given file and then call the corresponding api's to open the document. The files that enter into the system do not have an extension and we do not want to rely on the ext if any. We use Tikka to identify the file type but for docx and pptx files it returns application/x-tika-ooxml. Based on this there is no straighfwd way to determine whether to call Document doc = new Document(file.getAbsolutePath()); or Presentation pres = new Presentation(file.getAbsolutePath());

any suggestions please.
1 Like

Hi,

You can use FileFormatUtil.DetectFileFormat method from Aspose.Word and Aspose.Cells etc. to detect file format. In fact Aspose.Cells method can detect more file formats as compared to Aspose.Words as you can see at http://www.aspose.com/docs/display/cellsnet/Aspose.Cells.FileFormatType+Enumeration

Unknown format will be returned if file is not recognized by any API.

Best Regards,

Thank you that was very helpful