4

Working on Magento 2 custom module implementation and want to add a browse button to upload a file in admin form.

I have gone through the

Magento2 : Admin module Image upload code to display form

but it's not working for me.

Any help is appreciated.

Thanks!

enter image description here

Rafael Corrêa Gomes
  • 13,309
  • 14
  • 84
  • 171
Amit Dwivedi
  • 1,550
  • 19
  • 37

1 Answers1

0
if ($id) {
                $model->load($id);
            }
After This Add the below code

 if(is_array( $data['image'])){
                $data['image']=implode(" ",$data['image']);

                $model->setData($data);

            }
            else {
                $model->setData($data);
            }

Do this thing it will solve ur issue

Amit Bera
  • 77,456
  • 20
  • 123
  • 237