How to block duplicate file name upload? | Community
Skip to main content
Level 3
September 17, 2024

How to block duplicate file name upload?

  • September 17, 2024
  • 4 replies
  • 1541 views

Hi Brains Trust,

 

On onsite AEM DAM I am facing a challenge - users can upload files with the same filenames that already exist in the library. Some filenames are the same, but have either first capital letter or lower case... I want to block such option. Anyone uploading a file with the filename that already exists on the library (case not sensitive) should be notified and not allowed to upload unless file is renamed. 

 

Does such feature exist or is possible on AEM DAM?

 

Thanks

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

4 replies

diksha_mishra
Community Advisor
Community Advisor
September 17, 2024

@poveim You can customize AEM's Asset Upload feature. Here’s how:

1. Event Listener/Workflow: Set up an event listener (or workflow) that triggers on asset upload. This listener will check the filename against the existing assets in the DAM.
2. Custom Validation Logic:
- Implement a service that performs a case-insensitive search in the DAM repository to check if any file with the same name (ignoring case differences) already exists.

3. Upload Restriction: If the query returns a match, block the upload process by throwing an error in the validation logic, notifying the user that a file with the same name already exists.

4. User Notification: Show a user-friendly message to the uploader to rename the file if there’s a conflict. You can leverage AEM's Granite UI framework for this, or a custom frontend dialog if needed.

 

PovEimAuthor
Level 3
September 17, 2024

Thank you for the reply, Diksha!

 

It seems creating this workflow on my own is beyond my knowledge of the AEM DAM at the moment. I'll raise a ticket for this workflow to be created. 

 

Many thanks!

Adobe Employee
September 18, 2024

Hi ,

OOTB AEM Dam doesn't have this feature. However , if you still need this you can customize this as below :

 

Develop a custom OSGi bundle implementing AssetUploadNameValidator interface. Override the validate method to check filenames with existing name (case-insensitive) logic. Register the bundle as an OSGi service and configure it in AEM's OSGi settings.

PovEimAuthor
Level 3
September 19, 2024

Hi Digarg,

Thanks for the another option on this matter. I will pass this to the devs. 

Meanwhile I will be downloading entire database CSV, marking duplicate filenames through conditional formatting and fixing them manually. 

khamat_bn
Level 4
October 9, 2024

@poveim 

There is one feature which checks the duplicate Asset Detection by checking SHA 1 checksum value.

Its the popup that appears when user upload the same asset even if the filename is different. 

 

Check this document 
https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/assets/admin/detect-duplicate-assets#:~:text=Navigate%20to%20Tools%20%3E%20Assets%20%3E%20Assets,if%20the%20filenames%20are%20different.

PovEimAuthor
Level 3
October 9, 2024

Thanks @khamat_bn ,

 

I forgot to mention I am on 6.5 onsite version which advises this: https://experienceleague.adobe.com/en/docs/experience-manager-65/content/assets/managing/duplicate-detection

It does detect duplicates via pixel recognition but if there are two different images with the same filename it lets it slip. 

kautuk_sahni
Community Manager
Community Manager
October 9, 2024

@poveim Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!

Kautuk Sahni