Unable to show Asset size restriction popup only for Images in AEM 6.5 | Community
Skip to main content
Level 4
April 3, 2025
Solved

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

  • April 3, 2025
  • 1 reply
  • 617 views

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-restrict-dam-upload-size-not-by-mime-type/m-p/668689.

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-video-assets#configuration-to-upload-assets-that-are-larger-than-gb

 

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

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.

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

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.

1 reply

arunpatidar
Community Advisor
Community Advisor
April 3, 2025

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-extensions-as-the-same-name/td-p/746489 

Arun Patidar
RajumuddanaAuthorAccepted solution
Level 4
April 3, 2025

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.

arunpatidar
Community Advisor
Community Advisor
April 3, 2025

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