Any java/servlet/string function where we can find out the mimeType of a file in AEM | Community
Skip to main content
Level 2
July 13, 2017
Solved

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

  • July 13, 2017
  • 3 replies
  • 3015 views

Hi All,

It's something we are seeing up for restricting certain file types in 6.2.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

shrotiAdobe EmployeeAccepted solution
Adobe Employee
July 13, 2017
AseemaAuthor
Level 2
July 13, 2017

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

Adobe Employee
July 14, 2017

-> 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:

/content/dam/test.jpg/jcr:content/metadata/dam:MIMEtype

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)