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

Avatar

Avatar
Validate 1
Level 1
Aseema
Level 1

Likes

0 likes

Total Posts

16 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
Aseema
Level 1

Likes

0 likes

Total Posts

16 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
Aseema
Level 1

13-07-2017

Hi All,

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Level 3
ashu4pma
Level 3

Likes

17 likes

Total Posts

38 posts

Correct reply

15 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 5
View profile

Avatar
Boost 5
Level 3
ashu4pma
Level 3

Likes

17 likes

Total Posts

38 posts

Correct reply

15 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 5
View profile
ashu4pma
Level 3

13-07-2017

Answers (2)

Answers (2)

Avatar

Avatar
Boost 5
Level 3
ashu4pma
Level 3

Likes

17 likes

Total Posts

38 posts

Correct reply

15 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 5
View profile

Avatar
Boost 5
Level 3
ashu4pma
Level 3

Likes

17 likes

Total Posts

38 posts

Correct reply

15 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 5
View profile
ashu4pma
Level 3

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

Avatar

Avatar
Validate 1
Level 1
Aseema
Level 1

Likes

0 likes

Total Posts

16 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
Aseema
Level 1

Likes

0 likes

Total Posts

16 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
Aseema
Level 1

13-07-2017

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