CodeIgniter Forums

Full Version: Image not showing in codeigniter 4
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
> thanks a lot. you helped me lot,no words to say thank's working

For the benefit of other users who may have the same problem, please explain the steps required to display the image.
working code
// created assets/avatar directory in public
//Controller in add function
use CodeIgniter\Files\File; // use above the class.

function add() {
$file = new File( $this->request->getFile( 'avatar' ) );
$ext = $file->guessExtension();
$name = 'avatar_'.$insert_id.'.'.$ext;
$PATH = getcwd();
$avatar->move( $PATH .'\assets\avatar', $name );
<img src="<?=base_url();?>/public/assets/avatar/<?=$value->avatars?>">

that is step...worked for me
thanks for helping me.
Thank you Smile
Pages: 1 2