我是AEM的新手,我想在cq对话框中创建一个带有fileupload(pdf,jpeg)的页面模板。 我只找到了缩略图的方法,但我找不到正确上传的方法。
缩略图构思/结构是来自'create collection'。
我的xml结构:
<form
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form"
class="foundation-form content-container"
foundationForm="{Boolean}true"
maximized="{Boolean}true"
method="post"
style="vertical">
<items jcr:primaryType="nt:unstructured">
<thumbnail
granite:class="share-resource-image grid"
jcr:primaryType="nt:unstructured"
sling:resourceType="dam/gui/coral/components/commons/thumbnail"
asset="${empty param.item ? requestPathInfo.suffix : param.item}"
defaultPreview="{Boolean}true">
<actions jcr:primaryType="nt:unstructured">
<upload
granite:id="thumbnail-upload-button"
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/fileupload"
autoStart="{Boolean}false"
mimeTypes="[image/png,image/jpeg,application/pdf]"
multiple="{Boolean}false"
name="coverImage"
renderReadOnly="{Boolean}true"
sizeLimit="100000000"
text="Dokument hochladen"
uploadUrl="will_be_replaced"
useHTML5="{Boolean}false"/>
</actions>
</thumbnail>
<removemanualthumbnail
granite:id="removemanualthumbnail"
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/hidden"
name="removemanualthumbnail"
value="false"/>
</items>
</form>
答案 0 :(得分:1)
尝试使用:
<fileupload
jcr:primaryType="nt:unstructured"
jcr:title="files"
sling:resourceType="granite/ui/components/foundation/form/fieldset">
<items jcr:primaryType="nt:unstructured">
<file
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/fileupload"
autoStart="{Boolean}true"
cq-msm-lockable="/file"
fieldLabel="the label for the field"
mimeTypes="[image/png,image/jpeg,application/pdf]"
multiple="{Boolean}false"
name="./file"
sizeLimit="100000000"
text="Dokument hochladen"
uploadUrl="/content/dam/someurl"
uploadUrlBuilder=""/>
</items>
</fileupload>
答案 1 :(得分:0)
我也面对这个。有两件事帮助了我:
<upload jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/fileupload"
text="Upload Image" name="./image/file.sftmp"
sizeLimit="1000000"
multiple="{Boolean}false"
async="{Boolean}true"
autostart="{Boolean}false"
granite:class="cq-wcm-fileupload"
uploadUrl="will_be_replaced">
<granite:data jcr:primaryType="nt:unstructured" cq-msm-lockable="./image" />
</upload>
但是,如果没有cq:对话节点http://localhost:4502/crx/de/index.jsp#/apps/core/wcm/components/page/v1/page/cq%3Adialog上的额外clientlib,上述内容将无效
<jcr:root jcr:primaryType="nt:unstructured"
sling:resourceType="cq/gui/components/authoring/dialog"
extraClientlibs="[cq.common.wcm,core.wcm.page.properties,cq.wcm.msm.properties]"
...