Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.
SOLVED

Unable to show Asset size restriction popup only for Images in AEM 6.5

Avatar

Level 4

Hi All,

 

I have a requirement to restrict and show a popup to my web masters to do not upload more than 20mb assets (png, jpg, tif .. etc but not pdf, zip), while I was searching web, I found this link https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-6-5-19-on-prem-restric....

I followed this, but I have couple of questions,

  1. Even though the Process step throws an error, but the Asset is already been uploaded to DAM (we shall delete through code though), hence not able to restrict from upload, right?
  2. Can we show a popup to the web master, so that he is aware of what went wrong.

In continuation to achieve my requirement, I decided to overlay(/apps/dam/gui/content/assets/jcr:content/actions/secondary/create/items/fileupload) OOTB file upload component/JS as suggested by @EstebanBustamante in his response in the above question and here also https://experienceleague.adobe.com/en/docs/experience-manager-65/content/assets/managing/managing-vi...

 

After overlay, my could see a popup with my custom sizelimit, which is good.

Screenshot 2025-04-03 at 08.21.32.png

But, the problem is I’m not able apply this restriction only for Images(png, jpg, tif .. etc but not pdf, zip).

Is there a different way to achieve this or property at fileUpload (when I checked library I didn’t find any such) to limit to only specific MIME types?

 

Thanks,

Raju.

1 Accepted Solution

Avatar

Correct answer by
Level 4

Hi @arunpatidar ,

 

Thanks for your response.

Yes, I did try that overlay of /libs/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js/fileupload.js but the challenge here is,

The “.on("dam-fileupload:filesizeexceeded", function(event) “ is triggered to show the error popup and this is being triggered from “/libs/clientlibs/granite/coralui3/js/all.js”

// Check file size

          if (self.sizeLimit && item.file.size > self.sizeLimit) {

            self.trigger('coral-fileupload:filesizeexceeded', {

              item: item

            });

          }

          }

I think, we are not supposed to overlay/customize files of this location, correct?

Otherwise I would have overlayed the above size check function, that would have solved my issue mostly.

I’m stuck here!

 

 

Correction-  I found there is different file which is triggering the size exceeded event, please find the files below

  1. /libs/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js/chunkfileupload.js
  2. /libs/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js/fileupload.js 

I did overlay these files with a custom sling servlet (to expose config details to access in JSs) + OSGI config (to configure Image MIME types, Max size)

Apologies for the confusion.

Thanks,

Raju.

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @Rajumuddana 

Please check fileupload js overlay if you can check the extension and size there.

File detail is at - https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/handle-various-tif-extensi... 

Arun Patidar

AEM LinksLinkedIn

Avatar

Correct answer by
Level 4

Hi @arunpatidar ,

 

Thanks for your response.

Yes, I did try that overlay of /libs/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js/fileupload.js but the challenge here is,

The “.on("dam-fileupload:filesizeexceeded", function(event) “ is triggered to show the error popup and this is being triggered from “/libs/clientlibs/granite/coralui3/js/all.js”

// Check file size

          if (self.sizeLimit && item.file.size > self.sizeLimit) {

            self.trigger('coral-fileupload:filesizeexceeded', {

              item: item

            });

          }

          }

I think, we are not supposed to overlay/customize files of this location, correct?

Otherwise I would have overlayed the above size check function, that would have solved my issue mostly.

I’m stuck here!

 

 

Correction-  I found there is different file which is triggering the size exceeded event, please find the files below

  1. /libs/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js/chunkfileupload.js
  2. /libs/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js/fileupload.js 

I did overlay these files with a custom sling servlet (to expose config details to access in JSs) + OSGI config (to configure Image MIME types, Max size)

Apologies for the confusion.

Thanks,

Raju.

Avatar

Community Advisor

Hi @Rajumuddana 

That true that we are not suppose to change anything within /libs

maybe you can check /libs/dam/gui/coral/components/commons/fileupload/action/render.jsp and try overlay if works.

Arun Patidar

AEM LinksLinkedIn