How to decline image upload when the size of the image is more than the expected? | Community
Skip to main content
New Participant
August 5, 2016
Solved

How to decline image upload when the size of the image is more than the expected?

  • August 5, 2016
  • 3 replies
  • 1651 views

Hi,

I want to stop the image upload and show an alert message to the author when the image size is more than certain number?

thanks

Srini

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

Write a custom Sling Servlet that uploads DAM Assets. In the Sling Servlet - use the Asset Manager API. You have full control and if the asset is larger than you want, you can prevent it from going into the DAM. See this article on how to use Asset Manager API: 

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

Hope this helps... 

3 replies

kautuk_sahni
Employee
August 8, 2016

Hi 

Also have a look at this old forum thread :- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__ibof-we_have_a_requiremen.html

//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.html. 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. 

 

Another Old post:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__nciy-hi_i_have_arequ.html

//

Yes, we can configure the Size limit of the assets.

Please find below the way of doing so:-

  1. In AEM, touch Tools > CRXDE Lite.
  2. In the CRXDE Lite page, in the directory window on the left, navigate to /jcr_root/apps/dam.
  3. You may need to touch the >> icon to see the directory window.
  4. In the /jcr_root/apps/dam folder, use the Create(if not present) drop-down list to create a node with the following directory structure:
    /gui/content/assets/_jcr_content/body/assetscontent/header/items/items/fileupload (it may be already present).
  5. When you are finished creating the node, the full path appears as the following:
  6. /jcr_root/apps/dam/gui/content/assets/_jcr_content/body/assetscontent/header/items/items/fileupload
  7. Select the fileupload node, then in the Properties tab, enter the following property value:
  8. {sizeLimit : "32212254720"}
  9. “chunkUploadMinFileSize property”:- The size above which an asset is considered a large asset.  You can configure the system to consider assets above 30 Mb (instead of 50 Mb) in size as large assets. In other words, the progress bar appears when assets above 30 Mb in size are uploaded.
  10. In the upper-left of the CRXDE Lite page, touch Save All.

 

Reference Links

1. https://docs.adobe.com/docs/en/aem/6-0/author/assets/managing-assets-touch-ui/managing-video-assets.html

2. https://docs.adobe.com/docs/en/aem/6-1/author/assets/managing-assets-touch-ui.html

 

This is the way to configure the limit of assets.

I hope this will solve your problem.

 

Thanks and Regards

Kautuk Sahni

Kautuk Sahni
SrininAuthor
New Participant
August 5, 2016

Thanks for quick reply!

smacdonald2008
smacdonald2008Accepted solution
New Participant
August 5, 2016

Write a custom Sling Servlet that uploads DAM Assets. In the Sling Servlet - use the Asset Manager API. You have full control and if the asset is larger than you want, you can prevent it from going into the DAM. See this article on how to use Asset Manager API: 

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

Hope this helps...