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.
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.
Solved! Go to Solution.
Views
Replies
Total Likes
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.
hi @Prashardan ,
Please find below the answer shared for the similar use-case below. Hope it helps!
Thanks,
Anil
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.
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.
My requirement is to completely restrict other formats except contentfragments and json under certain path.
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.
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.
Thank you @Prashardan for letting us know the correct solution!!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies