codeigniter - php function file_exists with condeigniter -


i using codeigniter, want show user page profile picture shown. when user uploads profile picture, same name username (where old profile picture overwritten). if hasn't uploaded profile picture, questionmark picture shown. use file_exists function, returns every time false.

$filename = base_url().'images/userimg/'.$this->session->userdata('username');  if(file_exists($filename)){ echo '<img src="'.$filename.'" width="300" height="300"  /><br/>'; } else {  echo '<img src="'.base_url().'images/no_image.jpg" width="300" height="300"  /><br/>';   } 

change codes this:

$filename = './images/userimg/'.$this->session->userdata('username'); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -