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.
SOLVED

FileUpload needs img to upload again and again

Avatar

Level 4

upload.jpg

 I have drag n dropped a logo from DAM and clicked save. Now when I open the dialog again, I can see that the previous link of logo is there but the dialog still needs me to add image.

 

can anybody tell me why is this happening? why the image is not retained

I'm using AEM 6.3 and following is the dialog code

 

<file
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/fileupload"
autoStart="{Boolean}true"
cq-msm-lockable="/file"
fieldLabel="Upload files"
mimeTypes="[image/*]"
multiple="{Boolean}false"
name="./file"
sizeLimit="100000000"
text="Upload file"
uploadUrl="/content/dam"
required="{Boolean}true"
allowUpload="{Boolean}false"
uploadUrlBuilder=""/>
1 Accepted Solution

Avatar

Correct answer by
Level 8

@Vinit_Pillai 

Please change mimeTypes property value as highlighted below, then it will work as expected.

 

<file
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/fileupload"
autoStart="{Boolean}true"
cq-msm-lockable="/file"
fieldLabel="Upload files"
mimeTypes="[image]"
multiple="{Boolean}false"
name="./file"
sizeLimit="100000000"
text="Upload file"
uploadUrl="/content/dam"
required="{Boolean}true"
allowUpload="{Boolean}false"
uploadUrlBuilder=""/>

 

View solution in original post

10 Replies

Avatar

Employee

Can you paste here how the File Upload is defined in the dialog?
And what AEM version you use.

Avatar

Level 4
Sorry for not providing all the info. I have updated my question.

Avatar

Correct answer by
Level 8

@Vinit_Pillai 

Please change mimeTypes property value as highlighted below, then it will work as expected.

 

<file
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/fileupload"
autoStart="{Boolean}true"
cq-msm-lockable="/file"
fieldLabel="Upload files"
mimeTypes="[image]"
multiple="{Boolean}false"
name="./file"
sizeLimit="100000000"
text="Upload file"
uploadUrl="/content/dam"
required="{Boolean}true"
allowUpload="{Boolean}false"
uploadUrlBuilder=""/>

 

Avatar

Employee
granite/ui/components/foundation/form/fileupload

This is legacy Coral2 FileUpload [1], better not to use it.
Try Coral3 FilleUpload [2], does the issue persists?

granite/ui/components/coral/foundation/form/fileupload


[1] https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/granite-ui... 
[2] https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/granite-ui... 

Avatar

Level 4

using Coral 3 lets me choose while . I want drag n drop so that user cannot upload anything outside DAM. Is there a  way to do this in coral3?

Avatar

Level 5

Hi @Vinit_Pillai ,

please update the dialog as below.

 

Spoiler
	<file
     jcr:primaryType="nt:unstructured"
     jcr:title="Image"
     sling:resourceType="granite/ui/components/foundation/form/fileupload"
     autoStart="{Boolean}false"
     class="cq-droptarget"
     fileNameParameter="./fileName"
     fileReferenceParameter="./fileReference"
     mimeTypes="[image]"
     multiple="{Boolean}false"
     name="./file"
     uploadUrl="${suffix.path}"
     useHTML5="{Boolean}true"/>

 

Avatar

Level 8

@Vinit_Pillai 

Please change mimeTypes value as mentioned below.

 

mimeTypes="[image]"

 

Avatar

Community Advisor

Hi @Vinit_Pillai 

Change the mimeTypes property value to image( remove /*), that should resolve your issue.

-AG

Avatar

Level 4
This fixed it . thanks Can you please tell me how to disable browsing files and only allow to drag n drop in coral 3 component. as it came to my attention I'm using coral 2 component.

Avatar

Community Advisor

Use cq/gui/components/authoring/dialog/fileupload  which core v2 Image component also uses.