I am trying to create a multi-image upload field in customer_form
.
Referring the official docs, I used ImageUploader
Uicomponent. Since, it extends FileUploader
UiComponent I have added isMultipleFiles
configuration to true.
But I am not able to select multiple files. I tried this in a fresh Magento 2.4.3 install, still no success.
Here is my code:
<field name="seller_banners" formElement="imageUploader">
<settings>
<notice translate="true">Upload multiple seller banners.</notice>
<label translate="true">Seller Banners</label>
<componentType>imageUploader</componentType>
</settings>
<formElements>
<imageUploader>
<settings>
<allowedExtensions>jpg jpeg png</allowedExtensions>
<maxFileSize>2097152</maxFileSize>
<isMultipleFiles>true</isMultipleFiles>
<uploaderConfig>
<param xsi:type="url" name="url" path="catalog/category_image/upload"/>
</uploaderConfig>
<previewTmpl>Magento_Catalog/image-preview</previewTmpl>
<openDialogTitle>Media Gallery</openDialogTitle>
<initialMediaGalleryOpenSubpath>catalog/category</initialMediaGalleryOpenSubpath>
</settings>
</imageUploader>
</formElements>
</field>
Official Docs:
Screenshots:
It seems the
isMultipleFiles
value is not changed/reflected in the DOM. It is stillfalse
when I checked using KnockoutJS debugger. At the sametime,maxFileSize
andallowedExtensions
works fine. Editingfile-uploader.js
and changing the default value ofisMultipleFiles
to true works.