Hello
At the moment the 'Add Rendition' file upload only works for 1 rendition at a time, my client asked me if it is possible to make it work for multiple renditions at a time.
I found the corresponding node under '/libs/dam/gui/content/assetdetails/jcr:content/actions/fileupload' and set the the multiple property to 'true'
The fileupload dialog now allows me to select multiple images but In the end it gives an error. If I for example select 2 images, only 1 of them get uploaded, I get a 500 response for the other:
What am I missing, how can I make this work?
Solved! Go to Solution.
Hi jeroend42683933
I just followed overlaying /libs/dam/gui/content/assetdetails/jcr:content/actions/fileupload to /apps/dam/gui/content/assetdetails/jcr:content/actions/fileupload and update multiple property to true. Its allowing me to select multiple but not upload.
After investigation I don;t see any servlet submission when uploading the asset rendition
Looks like sling:resourceType property is granite/ui/components/coral/foundation/form/fileupload
This granite widget can upload only one item (rendition). I think you need a custom widget to handle multiple renditions.
Hope this helps
~Manoj
I have asked internal expert to have a look at this.
Thank you
I guess the Servlet on the backed is programmed to handle only 1 asset per request.
If you want to upload Assets in a batch operation - you can build a custom Sling Servlet that uses the Asset Manager API. Each Asset that is uploaded will have its own renditions as a result of using the Asset Manager API.
"The CQ5 Quickstart and Web Application."
We have a demo tool that does this. It uses a Java client that reads an XML file that describes where the assets are located and posts each file to the Servlet.
So if for example have hundreds of files in a folder - this works well
Views
Replies
Total Likes
Where or how can I find the current servlet that handles the 'add rendition' functionality? The weird things is that the post to the rendition endpoint is executed twice (one of those returns a 200 the other one a 500) which makes me think that the servlet is only handling one file at a time but something else is going wrong, I see this in my error.log:
21.11.2017 08:58:16.425 *ERROR* [0:0:0:0:0:0:0:1 [1511251096318] POST /content/dam/1680jpg.jpg/_jcr_content/renditions HTTP/1.1] org.apache.sling.servlets.post.impl.operations.ModifyOperation Exception during response processing.
org.apache.sling.api.resource.PersistenceException: Unable to commit changes to session.
at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.commit(JcrResourceProvider.java:499)
at org.apache.sling.resourceresolver.impl.providers.stateful.AuthenticatedResourceProvider.commit(AuthenticatedResourceProvider.java:215)
at org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.commit(ResourceResolverControl.java:421)
at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.commit(ResourceResolverImpl.java:1177)
at org.apache.sling.servlets.post.AbstractPostOperation.run(AbstractPostOperation.java:160)
at org.apache.sling.servlets.post.impl.SlingPostServlet.doPost(SlingPostServlet.java:205)
...
Caused by: javax.jcr.InvalidItemStateException: OakState0001: Unresolved conflicts in /content/dam/1680jpg.jpg/jcr:content/renditions/renditions2.png/jcr:content
at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:237)
at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:212)
at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:670)
....
Caused by: org.apache.jackrabbit.oak.api.CommitFailedException: OakState0001: Unresolved conflicts in /content/dam/1680jpg.jpg/jcr:content/renditions/renditions2.png/jcr:content
at org.apache.jackrabbit.oak.plugins.commit.ConflictValidator.failOnMergeConflict(ConflictValidator.java:115)
at org.apache.jackrabbit.oak.plugins.commit.ConflictValidator.propertyAdded(ConflictValidator.java:84)
at org.apache.jackrabbit.oak.spi.commit.CompositeEditor.propertyAdded(CompositeEditor.java:83)
at org.apache.jackrabbit.oak.spi.commit.EditorDiff.propertyAdded(EditorDiff.java:82)
at org.apache.jackrabbit.oak.segment.SegmentNodeState.compareProperties(SegmentNodeState.java:617)
What does this tell me?
Views
Replies
Total Likes
Apparently the coral-fileupload element has an async attribute:
<coral-fileupload
class="betty-ActionBar-item coral-Form-field cq-damadmin-admin-actions-rendition-upload-activator coral3-FileUpload"
name="will_be_replaced" multiple="" sizelimit="10485760"
action="/content/dam/jeroen/de_mol.png/_jcr_content/renditions?_charset_=utf-8" async=""
data-foundation-validation="" data-validation="" role="group" style="position: relative;" aria-disabled="false"
aria-invalid="false" aria-readonly="false">
</coral-fileupload>
If I set the attribute to 'false' it still does not work :S
Views
Replies
Total Likes
THis is why you can look at writing a custom tool that can upload assets to AEM via Servlet that uses the AssetManager API. The Coral FileUploader seems to only handle one at a time.
Views
Replies
Total Likes
Hi jeroend42683933
I just followed overlaying /libs/dam/gui/content/assetdetails/jcr:content/actions/fileupload to /apps/dam/gui/content/assetdetails/jcr:content/actions/fileupload and update multiple property to true. Its allowing me to select multiple but not upload.
After investigation I don;t see any servlet submission when uploading the asset rendition
Looks like sling:resourceType property is granite/ui/components/coral/foundation/form/fileupload
This granite widget can upload only one item (rendition). I think you need a custom widget to handle multiple renditions.
Hope this helps
~Manoj
I developed my own solution: https://jeroendruwe.be/aem-6-3-uploading-multiple-renditions/
Views
Likes
Replies