currently I'm trying to develop an image upload in the Magento admin area with ui components. My fieldset declarations looks like this:
<fieldset name="slide">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Slide Konfiguration</item>
</item>
</argument>
<!-- other fields -->
<field name="image">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="required" xsi:type="boolean">true</item>
<item name="label" xsi:type="string">Bild*</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="cssslider/configuration/upload"/>
</item>
</item>
</argument>
</field>
</fieldset>
My upload
action contains this line
$result = $this->imageUploader->upload('slide');
If I stop code here with a breakpoint and inspect the $_files
array, it looks like this:
Every item in the slides array contains another array?! (Whyyy?!!) And because of this my code throws an exception in the Magento\Framework\File\Uploader class in line 162 where it checks, if the file already exists:
if (!file_exists($this->_file['tmp_name'])) {
$this->_file
contains the slide-array of the $_files
array.
Anybody got an idea what I need to do to fix this issue?