0

I'm Using UI component to upload an image but it throws this error

Fatal error: Uncaught TypeError: Argument 2 passed to Magento\Framework\View\Element\UiComponentFactory::argumentsResolver() must be of the type array, null given, called in C:\xampp\htdocs\Magento\vendor\magento\framework\View\Element\UiComponentFactory.php on line 220 and defined in C:\xampp\htdocs\Magento\vendor\magento\framework\View\Element\UiComponentFactory.php:172 Stack trace: #0 C:\xampp\htdocs\Magento\vendor\magento\framework\View\Element\UiComponentFactory.php(220): Magento\Framework\View\Element\UiComponentFactory->argumentsResolver('banner', NULL) #1 C:\xampp\htdocs\Magento\vendor\magento\module-ui\Component\Form\Field.php(84): Magento\Framework\View\Element\UiComponentFactory->create('banner', 'imageUploader', Array) #2 C:\xampp\htdocs\Magento\vendor\magento\framework\View\Layout\Generator\UiComponent.php(159): Magento\Ui\Component\Form\Field->prepare() #3 C:\xampp\htdocs\Magento\vendor\magento\framework\View\Layout\Generator\UiComponent.php(156): Magento\Framework\View\Layout\Generator\UiComponent->prepareC in C:\xampp\htdocs\Magento\vendor\magento\framework\View\Element\UiComponentFactory.php on line 172

My Code for Image Uploader is

        <field name="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">flashsalespro</item>
                <item name="dataScope" xsi:type="string">banner</item>
                <item name="label" xsi:type="string" translate="true">Upload Banner</item>
                <item name="visible" xsi:type="boolean">true</item>
                <item name="formElement" xsi:type="string">imageUploader</item>
                <item name="sortOrder" xsi:type="number">150</item>
                <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
                <item name="previewTmpl" xsi:type="string">PME_FlashSalesPro/image-preview</item>
                <item name="required" xsi:type="boolean">false</item>
                <item name="notice" xsi:type="string" translate="true">Upload image for sales background.</item>
                <item name="uploaderConfig" xsi:type="array">
                    <item name="url" xsi:type="url" path="sales/index/upload"/>
                </item>
            </item>
        </argument>
    </field>
1

It was because of this line

<item name="dataScope" xsi:type="string">banner</item>

I removed it now it is working fine..

  • great work @gee Emm – i_ali55 Mar 11 at 14:03

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.