3

I'm using UI component for building admin form. In the form, I have an image uploader field.

Using this uploader, I'm able to select only one image to upload. But I need to upload multiple images.

On referring to Magento docs, isMultipleFiles option needs to be true.

<field name="image" sortOrder="10" formElement="imageUploader">
<settings>
    <label translate="true">Image</label>
    <elementTmpl>ui/form/element/uploader/image</elementTmpl>
    <visible>true</visible>
    <validation>
        <rule xsi:type="boolean" name="required-entry">true</rule>
    </validation>
</settings>
<formElements>
    <imageUploader>
        <settings>
            <isMultipleFiles>true</isMultipleFiles>
            <validation>
                <rule xsi:type="boolean" active="false" name="required-entry">true</rule>
            </validation>
            <uploaderConfig>
                <param xsi:type="string" name="url">sample/image/upload</param>
            </uploaderConfig>
            <previewTmpl>Module/image-preview</previewTmpl>
        </settings>
    </imageUploader>
</formElements>

But still, the uploader is able to select only one image. Am I missing something here?

1 Answer 1

0
<field name="image">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="dataType" xsi:type="string">string</item>
                <item name="label" xsi:type="string" translate="true">Add  Image</item>
                <item name="visible" xsi:type="boolean">true</item>
                <item name="formElement" xsi:type="string">imageUploader</item>
                <item name="previewTmpl" xsi:type="string">Magento_Catalog/image-preview</item>
                <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
                <item name="isMultipleFiles" xsi:type="boolean">true</item>
                <item name="dataScope" xsi:type="string">image</item>
                <item name="uploaderConfig" xsi:type="array">
                    <item name="url" xsi:type="url" path="sample/image/upload"/>
                </item>
            </item>
        </argument>
    </field> 

Refrence: Magento 2.3 : Multiple image upload in admin form ui component?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.