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

4
  • pls show code and error. u can get error in var/log/system.log .
    – xanka
    Jan 13, 2016 at 9:38
  • I added the error. please see Jan 13, 2016 at 11:06
  • 1
    i things field image is not true or null. U should check $data before save.
    – xanka
    Jan 14, 2016 at 1:22
  • Please update your question with your code, it's like we have to imagine how is your code which is absolutely different with the code inside the reference link you posted. Jul 10, 2017 at 3:42

1 Answer 1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.