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>