Any java/servlet/string function where we can find out the mimeType of a file in AEM

Answers (2)

Answers (2)



-> I wanted a java/servlet function which extracts the mimeType of a file that we are putting for upload

AEM Assets already extracts Mimetype and persist under asset's metadata:


In Servlet, you could use the service as I have mentioned[0] to detect mime type from an input stream of the file (sourced by TIKA library).

[0]Apache Sling - MIME Type Support (commons.mime and commons.contentdetection)