Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Restrict file uploads by size & type in DAM upload dialog

Avatar

Level 1

We have a requirement to restrict file uploads in DAM by a maximum file size and white list of valid file types. I cannot find any Adobe documentation regarding this subject. Is there a configuration that can control these parameters? If not, what would need to be done to restrict DAM uploads by these parameters?

10 Replies

Avatar

Employee Advisor

I posted following answer to the same question in another thread- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

I don't know whether there is any OOTB configuration to limit the file types. But there is a community article for restricting the upload based on size of the file - http://experience-aem.blogspot.com/2014/12/aem-6-sp1-classic-ui-restrict-large-or-small-files-upload.... You can customize it and add your logic of checking the file types. You can either just check the file extensions in the javascript or invoke a backend servlet to check the file headers for the mime types. Also, this is limited to Classic UI only. 

Avatar

Level 10

If you refer the OOB workflow 'DAM Update Asset' workflow, there you can configure which file types should be allowed. Similarly, you can write custom workflowprocess service to check the type and size of the asset and restrict the uploads accordingly.

Avatar

Administrator

Hi

As mentioned by Kunal, you can follow the article :- 

Link:- http://experience-aem.blogspot.in/2014/12/aem-6-sp1-classic-ui-restrict-large-or-small-files-upload....

Or

You could create a custom sling servlet, that will upload assets for you. There you can insert you logic to restrict anything.

Link:- https://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html

 

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 1

If I were to write my own upload servlet, how would I remove access to the default file upload? Would that be done with user permissions?

Avatar

Level 10

If you write your own upload servlet to handle DAM assets - you have full control over what gets placed into the DAM. You can also use the AssetManager API. 

    com.day.cq.dam.api.AssetManager assetMgr = resourceResolver.adaptTo(com.day.cq.dam.api.AssetManager.class);
    String newFile = "/content/dam/travel/"+fileName ; 
    assetMgr.createAsset(newFile, is,"image/jpeg", true);

We have an example of a custom Servlet that uses the AssetManager API here: 

https://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html

Avatar

Level 4

Please check with Adobe for hotfix (71519).This will allow you to configure the allowed MIME types.

Avatar

Level 4

I have implemented for a similar scenario long time back. Please drop me an email at gameon300@gmail.com if you still need help with this as your posted question is pretty old as I can see.

Regards,

Samir

Avatar

Administrator

$@^^!R wrote...

I have implemented for a similar scenario long time back. Please drop me an email at gameon300@gmail.com if you still need help with this as your posted question is pretty old as I can see.

Regards,

Samir

 

Hi Samir

It would be a great help, if you can share the solution with us here in the community for communities benefit.

~kautuk



Kautuk Sahni

Avatar

Level 4

Hi @kautuk_sahni 

i am also facing same issue for svg in AEMaaCS

please help.

Avatar

Level 3

Hi @saurabh_kumar_02 ,

Looks like it's known issue since long time. 

You can find same question being asked in below thread long back,

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/svg-file-not-getting-impor...

 

Was there any fix ever provided?

@kautuk_sahni can you pls confirm?

Thanks,