I have created form in which we can select an image using and i want to store path in database.

here i can successfully added image and i can store the name in database also.but what i want is instead of showing only name it should show the full path of that image

and when i submit the data in database it should save the same path in database. and i have further operations in admin also.. but now atlst i have to show all this


In your case,you have to get image name from your database table. Then get the base url of your website as:-


And then your image folder structure as:-

pub/media/<Image Folder>

At last, concatinate the three results as:-

$this->getBaseUrl./pub/media/<Image Folder>.<image_name>

this will take you to your image. Hope this helps you.

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.