0
<fieldset name="dealz_info" sortOrder="11">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="collapsible" xsi:type="boolean">false</item>
                <item name="label" xsi:type="string" translate="true">Dealz Information</item>
                <item name="sortOrder" xsi:type="number">20</item>
            </item>
        </argument>

<fieldset name="english_storeinfo">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="collapsible" xsi:type="boolean">true</item>
                    <item name="label" xsi:type="string" translate="true"> English Store Info</item>
                    <item name="sortOrder" xsi:type="number">21</item>
                </item>
            </argument>
<field formElement="imageUploader" name="prize_image">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="source" xsi:type="string">Prize Image</item>
                    </item>
                </argument>
                <settings>
                    <elementTmpl>ui/form/element/uploader/image</elementTmpl>
                    <dataType>string</dataType>
                    <label translate="true">Prize Image</label>
                    <visible>true</visible>
                    <!-- <validation>
                        <rule name="required-entry" xsi:type="boolean">true</rule>
                    </validation> -->
                </settings>
                <formElements>
                    <imageUploader>
                        <settings>
                            <required>true</required>
                            <uploaderConfig>
                                <param xsi:type="url" name="url" path="dealz/dealz/uploadimage"/>
                            </uploaderConfig>
                            <previewTmpl>Vendor_Dealz/image-preview</previewTmpl>
                            <openDialogTitle>Media Gallery</openDialogTitle>
                            <allowedExtensions>jpg jpeg gif png</allowedExtensions>
                            <maxFileSize>4194304</maxFileSize>
                        </settings>
                    </imageUploader>
                </formElements>
            </field>
    </fieldset>
    </fieldset>

I expected the file to upload without failure. If remove one level of fieldset the upload works.but error as Undefined index: english_storeinfo][prize_image.How to works with multiple fieldsets?

my controller execute() for image upload is

public function execute()
    {
      

        try {
            if (isset($data['param_name'])) {

                $result = $this->imageUploader->saveFileToTmpDir($data['param_name']);
                $result['cookie'] = [
                    'name' => $this->_getSession()->getName(),
                    'value' => $this->_getSession()->getSessionId(),
                    'lifetime' => $this->_getSession()->getCookieLifetime(),
                    'path' => $this->_getSession()->getCookiePath(),
                    'domain' => $this->_getSession()->getCookieDomain(),
                ];
            }
        } catch (\Exception $e) {
            $result = ['error' => $e->getMessage(), 'errorcode' => $e->getCode()];
        }
        return $this->resultFactory->create(ResultFactory::TYPE_JSON)->setData($result);
    }
   

Refrence for Image upload: https://www.codextblog.com/magento-2/how-to-upload-image-or-file-in-custom-module-using-ui-component-in-magento-2/

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy