I have tried below code for adding thumbnail image in category.
When i upload image in custom field i get below error.
Error
Attention
The file was not uploaded.
error: "The file was 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>
asked Sep 22, 2016 at 10:22
Deeban Babu
50510 silver badges23 bronze badges
-
check this link magento.stackexchange.com/questions/129870/…Pratik– Pratik2016年09月22日 10:42:17 +00:00Commented Sep 22, 2016 at 10:42
-
Please check updated question still i have same issueDeeban Babu– Deeban Babu2016年09月22日 11:13:33 +00:00Commented Sep 22, 2016 at 11:13
-
check this module on github github.com/pratikmage/magento2-subcategoryPratik– Pratik2016年09月22日 12:59:38 +00:00Commented Sep 22, 2016 at 12:59
-
1@Pratik I checked that module now error not showing file upload successfully but image not stored in dbDeeban Babu– Deeban Babu2016年09月23日 06:18:50 +00:00Commented Sep 23, 2016 at 6:18
-
it's bug in magento and it's fix by following patch github.com/magento/magento2/pull/5978/filesPratik– Pratik2016年09月23日 08:40:52 +00:00Commented Sep 23, 2016 at 8:40
default