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

Extending DAM Asset Upload Restriction - UI Notification

vivek-sachdeva
Level 1
Level 1

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
kunal23
Correct answer by
Level 10
Level 10

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

5 Replies
kunal23
Correct answer by
Level 10
Level 10

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

shelly-goel
Community Advisor
Community 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...

 

vivek-sachdeva
Level 1
Level 1
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
shelly-goel
Community Advisor
Community Advisor
@vivek-sachdeva - oob file can be overlaid, yes if there's another option then you can choose