Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

Avatar

Level 2

Hi All,

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

1 Accepted Solution

Avatar

Correct answer by
Level 4
0 Replies

Avatar

Correct answer by
Level 4

Avatar

Level 2

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

Avatar

Level 4

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