1

string category Menu Image true fileUploader ui/form/element/uploader/uploader Magento_Catalog/image-preview false 40

    <field name="image_banner">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="dataType" xsi:type="string">string</item>
                <item name="source" xsi:type="string">category</item>
                <item name="label" xsi:type="string" translate="true">Banner Image</item>
                <item name="visible" xsi:type="boolean">true</item>
                <item name="formElement" xsi:type="string">fileUploader</item>
                <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
                <item name="previewTmpl" xsi:type="string">Magento_Catalog/image-preview</item>
                <item name="required" xsi:type="boolean">false</item>
               <item name="sortOrder" xsi:type="number">40</item>
                <item name="uploaderConfig" xsi:type="array">
                    <item name="url" xsi:type="url" path="sunny_catalog/category_banner/upload"/>
                </item>
            </item>
        </argument>
    </field>

Error

file-uploader.js:74 Uncaught TypeError: value.map is not a function at UiClass.setInitialValue (file-uploader.js:74) at UiClass.initialize (abstract.js:77) at UiClass.initialize (wrapper.js:109) at new UiClass (class.js:49) at Object.initComponent (layout.js:137) at fire (jquery.js:3232) at Object.fireWith [as resolveWith] (jquery.js:3362) at Object.deferred.(/admin/catalog/category/index/key/5db0e6c2fed75d6118a879c215380e99c30f8d28c6a6d83414a674946b107297/anonymous function) (pub/static/adminhtml/Magento/backend/en_US/jquery.js:3461:37) at fire (jquery.js:3232) at Object.fireWith [as resolveWith] (jquery.js:3362)

0

You Need To Add Field In Vendor\Module\view\adminhtml\ui_component\category_form.xml

<fieldset name="general">
        <field name="your_attributte" sortOrder="40" formElement="fileUploader">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="source" xsi:type="string">category</item>
                </item>
            </argument>
            <settings>
                <elementTmpl>ui/form/element/uploader/uploader</elementTmpl>
                <dataType>string</dataType>
                <label translate="true">Your Label</label>
                <visible>true</visible>
                <required>false</required>
            </settings>
            <formElements>
                <fileUploader>
                    <settings>
                        <required>false</required>
                        <uploaderConfig>
                            <param xsi:type="url" name="url" path="route_id/admin_controller_path/controller_file_name"/>
                        </uploaderConfig>
                        <previewTmpl>Magento_Catalog/image-preview</previewTmpl>
                    </settings>
                </fileUploader>
            </formElements>
        </field>
  • this not working i try it already once – Dipesh Balar Mar 13 at 12:53
  • any error generated for this code ? – Rk Rathod Mar 13 at 13:18
  • yes same mentioned above – Dipesh Balar Mar 13 at 13:31
  • check uploader path – Rk Rathod Mar 13 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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