Welcome Guest, Not a member yet? Register   Sign In
Image not showing in codeigniter 4
#11

@durairaj
> thanks a lot. you helped me lot,no words to say thank you.it's working

For the benefit of other users who may have the same problem, please explain the steps required to display the image.
Reply
#12

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 );
}
//view
<img src="<?=base_url();?>/public/assets/avatar/<?=$value->avatars?>">

that is step...worked for me
thanks for helping me.
Reply
#13

Thank you Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB