Expand my Community achievements bar.

SOLVED

Unable to use "file upload" component for forms (OOB)

Avatar

Level 5

In one of the forms, we added a file upload component. The form works perfect for admins (since admins have jcr:all) under the node where data is stored. however, when we upload a file, under the jcr, it creates a node of file type "nt:file" for each entry folder. Issue is the top level node by default has jcr:addChildNodes permissions for users (everyone), but that fails and user gets unauthorized error.

I had to change the permissions to jcr:all for everyone for the node where data is stored for the form for users to submit.

This doesn't seem ideal way to do it. Users should be allowed to add even files OOB. Can anyone let me know if there is any other setting other than going to crx and adding everyone giving them jcr:all persmissions on the tree?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

You should grant jcr:modifyProperties on the parent node along with the jcr:addChildNodes on the top level folder.  Modify properties privilege is needed because when a child node is added then AEM updates the modification date property on the top level node. 

View solution in original post

5 Replies

Avatar

Level 10

Agreed - users should be able to upload files without an issue and as an AEM developer - you should be able to specify exactly where in the AEM JCR you want to place the file. For this use case - consider building your own FIle uploader component You can easily do this - we just updated an article recently for use on AEM 6.x - see: 

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

THis works nicely. 

However - you are correct - you need to specify the permissions for the OOTB uploader. 

Avatar

Level 5

Scott

This is odd though. If it's not there OOB, the file upload component shouldn't be under forms since it needs more than a power user to configure this. Typically we allow authors to create forms freely and they have no clue to set this up. If we don't use file control, it works perfectly.

 

Since you mentioned writing custom file upload, how would it fit inside a OOB form? I can write a file upload that doesn't sit inside a form. By Default a form handler would handle any data inside the form. If we write our own file uploader, how do we wire the form to include our handler while including file. Also then there would be issue with data of the form stored under the node specified in advanced config and our file uploader will have no idea where that node for that specific record is.

For now I think jcr:all makes sense but I was assuming it should do it as soon as we put that file upload under a form.

Avatar

Correct answer by
Employee Advisor

You should grant jcr:modifyProperties on the parent node along with the jcr:addChildNodes on the top level folder.  Modify properties privilege is needed because when a child node is added then AEM updates the modification date property on the top level node. 

Avatar

Level 5

Kunal

It's only if you add a upload file control in the form. else nothing is needed. Try it out. If you just add textboxes, no changes are needed. Any user can go and fill in the form. That's the query I have, if it works without any changes for text components, it should work with file upload.

Reason is forms are marketed as a tool for marketing folks. Here at our client site, our authors do a ton of authring and power user stuff. They did all or most forms by themselves but for this they had to contact IT.

I've resolved it for now, my question was more from a outreach perspective - if we can't use file upload control without going to crx, it takes away the "no need for IT" tagline out.

Avatar

Level 1

Hi,

I have encountered the same problem in my form,

I am working with adobe aem 6.4. i tried granting jcr:modifyProperties on the parent node along with the jcr:addChildNodes on the top level folder.

However it doesn't seems to work, could you specify exactly where did you grant the permissions? to which path?