Expand my Community achievements bar.

SOLVED

How can I change the name of an asset when it is uploaded in DAM?

Avatar

Level 5

Hello, what happens is that I need that the assets have a format in the name, this format is that the user can put the name he wants to the asset as long as it doesn't contain spaces, in case of containing space, the spaces must be replaced by micro (the symbol - ).

 

For example, let's say the user uploads an asset called:

 

my asset.jpg

 

Then when he uploads it to DAM at that time the name should be changed as follows:

 

my-asset.jpg

 

So that when the asset is finished uploading and processing, it will be displayed in the AEM DAM folder.

my-asset.jpg instead of my asset.jpg

 

How can I do that?

 

Aaron_Dempwolff_0-1694627236357.png

 

Aaron_Dempwolff_1-1694627817276.png

If it's possible to do it in my project folder it would be nice

Aaron_Dempwolff_0-1694644928738.png

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Aaron_Dempwolff,

It is not working because you are using /libs instead of /apps in your project structure. You also have to update filter.xml file to include your custom file, /apps/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js

The structure, and filter xml, are presented below

dam-fileupload.jpg

View solution in original post

7 Replies

Avatar

Level 5

Do you know if is possible to do it in the AEM project folder?

Aaron_Dempwolff_0-1694644964020.png

 

Avatar

Community Advisor

Hello @Aaron_Dempwolff 

 

We should be able to overlay the file in /apps folder "/apps/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js/fileupload.js".

 

Code can be checked in to ui.apps.

 

It has a following line. Please try adding space to it. Hopefully it should work

 

_ILLEGAL_FILENAME_CHARS: [ "©", "/", ":", "[", "\\", "]", "|", "#", "%", "{", "}", "?", "&" ],


Aanchal Sikka

Avatar

Level 5

I try to add it in the path that you tell me on my code, I create the folders of the path:

 

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

 

and create the js file with the change but it doesn't show the new change after the build.

I'm doing somethin wrong?, is the path that I did or something like that?

Aaron_Dempwolff_0-1694702979111.png

 

Avatar

Community Advisor

@Aaron_Dempwolff 

Please try adding js.txt as well to /apps. Also, please use incognito mode to assure that the file is not a cached one


Aanchal Sikka

Avatar

Level 5

Still doesn't work, I add even the css and js files and still not updating the new changes.

Aaron_Dempwolff_0-1694729438971.png

 

Avatar

Correct answer by
Community Advisor

Hi @Aaron_Dempwolff,

It is not working because you are using /libs instead of /apps in your project structure. You also have to update filter.xml file to include your custom file, /apps/dam/gui/coral/components/commons/fileupload/clientlibs/fileupload/js

The structure, and filter xml, are presented below

dam-fileupload.jpg