Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Extending DAM Asset Upload Restriction - UI Notification

Avatar

Level 2

Hi,

 

Currently we have requirement to add restrictions to DAM Asset Upload which checks file type, size and file content using for 3rd party API. We do this in DAM Update Asset Workflow by adding a custom step.

 

Currently we are stuck at a place where in case when file is not allowed, we are not able to show alert on UI to authors with some message. I see that "DAM Asset Upload Restriction" configuration has a nice alert saying upload failed. From what I checked that calls a servlet which returns error and then this alert is shown.

 

Is there a way we can do the same for our custom restrictions. If workflow is the best way for that or if we can have another way of doing it which is more user friendly.

 

Any help is appreciated..

 

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Instead of workflow you can write a filter to validate the file before it gets uploaded in AEM. 

You can find a sample of that filter here - http://experience-aem.blogspot.com/2018/11/aem-6420-file-decode-filter-virus-scan-to-decode-uploaded... 

The user will see the message even before the asset is uploaded in AEM. 

View solution in original post

6 Replies

Avatar

Correct answer by
Employee Advisor

Instead of workflow you can write a filter to validate the file before it gets uploaded in AEM. 

You can find a sample of that filter here - http://experience-aem.blogspot.com/2018/11/aem-6420-file-decode-filter-virus-scan-to-decode-uploaded... 

The user will see the message even before the asset is uploaded in AEM. 

Avatar

Employee Advisor

@vivek-sachdeva 

Another solution of adding upload restrictions like asset size, etc. could be done with overlaying this node: /libs/dam/gui/content/assets/jcr:content/actions/secondary/create/items/fileupload

and if 3rd party api logic has to be leveraged, that can be done by customizing below file which has "restrictedFiles" logic

/libs/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js/fileupload.js

These details are also mentioned in this post: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-dam-file-uploading/qaq...

 

Avatar

Level 2
Thanks for the reply Shelly.. Do understand that OOTB JS can be modified but I believe we should not modify OOTB code unless there is no other way. this could create issues while upgrading. In case there are updates to this file, we may not get it

Avatar

Employee Advisor
@vivek-sachdeva - oob file can be overlaid, yes if there's another option then you can choose