Expand my Community achievements bar.

SOLVED

file type restriction on specific dam path

Avatar

Level 4

Hi Team

I have a requirement to accept only content fragments and .json files to be either uploaded or created under /content/dam/<project_name>/subfolder. Other type files to should be restricted

 

I have checked this page but this can be achieved under /content/dam only.

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/assets/admin/con...

 

Is there way to add file type restrictions under child folders under dam like /content/dam/<project_name>/subfolder

 

Any advice or guidance please

 

Thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Level 6

Hi @Prashardan you can try creating a page having 2 fields and a button. The two fields would be: assest upload path and file type. Try writing a servlet which will be called on clicking the upload button. You can get the URL path and file type in it easily and check its validation and return a response depending on the validation and disable the upload button accordingly using AJAX. Use the AssetManager API to upload the asset at the given path if both path and file are correct. Write the logic in a serviceImpl and call it in the servlet in the end. For media assets like pdf and images you can convert them into base64 form.

View solution in original post

7 Replies

Avatar

Level 4

Thanks for your reply Anil.

 

Creating a custom workflow and adding a launcher is one way but would like to check is there any other way like repo scripts.

 

Also with respect to workflow, whenever a file is created or uploaded the launcher will trigger but what if any files are uploaded using a crx/de package.

 

Thanks in advance.

Avatar

Correct answer by
Level 6

Hi @Prashardan you can try creating a page having 2 fields and a button. The two fields would be: assest upload path and file type. Try writing a servlet which will be called on clicking the upload button. You can get the URL path and file type in it easily and check its validation and return a response depending on the validation and disable the upload button accordingly using AJAX. Use the AssetManager API to upload the asset at the given path if both path and file are correct. Write the logic in a serviceImpl and call it in the servlet in the end. For media assets like pdf and images you can convert them into base64 form.

Avatar

Level 4

My requirement is to completely restrict other formats except contentfragments and json under certain path.

 

Avatar

Level 6

yes, I told the approach for the same above. Make sure when you hit the path/click upload button, the above custom servlet is called.

Avatar

Level 4

Hi @kapil_rajoria @Anil_Chennapragada 

Thanks for your reply. 

I have overlayaed fileUpload.js file and added my changes. It worked fine. 

Many thanks for all the suggestions.