magento2 - Adding custom Image attribute for category in magento 2 -


i have tried below code adding thumbnail image in category.

when upload image in custom field below error.

error

attention

the file not uploaded.

error: "the file not uploaded." errorcode: 666

category_form.xml

<field name="thumbnail_image">             <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">category 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="catalog/category_image/upload"/>                     </item>                     <item name="label" xsi:type="string" translate="true">thumbnail image</item>                 </item>             </argument>         </field> 

installdata.php

$eavsetup->addattribute('catalog_category', 'thumbnail_image', array(     'input'   => 'image',     'type'    => 'varchar',     'backend' => 'catalog/category_attribute_backend_image',     'group' => 'general',     'label'         => 'thumbnail image',     'visible'       => 1,     'required'      => 0,     'user_defined' => 1,     'frontend_input' =>'',     'global'        => \magento\catalog\model\resourcemodel\eav\attribute::scope_global,     'visible_on_front'  => 1, )); 

di.xml

<config xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="../../../../../lib/internal/magento/framework/acl/etc/di.xsd"> <type name="namespace\module\controller\adminhtml\category\image">     <arguments>         <argument name="imageuploader" xsi:type="object">magento\catalog\categoryimageupload</argument>     </arguments> </type> </config> 


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -