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

  • pls show code and error. u can get error in var/log/system.log . – xanka Jan 13 '16 at 9:38
  • I added the error. please see – amit_game Jan 13 '16 at 11:06
  • 1
    i things field image is not true or null. U should check $data before save. – xanka Jan 14 '16 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. – Toan Nguyen Jul 10 '17 at 3:42
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, privacy policy and cookie policy

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