Welcome Guest, Not a member yet? Register   Sign In
i cant display images that i uploaded ..[SOLVED]
#1

[eluser]kosaidpo[/eluser]
hello great peeps

well im tryin to build my CI musculs by makin a forum even is jst a simple one but ...bla bla .. Big Grin
my problem is i have a function that upload the avatar user and store/update the db with path of the aploaded pic so when i call the column from the db wrapped in <img> tag nethin get displayed and now im here askin your help
heres my function controller
Code:
if($this->check_session()){    
        $config=array('upload_path'  =>'uploads' ,
                      'allowed_types'=>'gif|jpg|jpeg|png' ,
                      'max_width'    =>'50' ,
                      'max_height'   =>'50' ,
                      'overwrite'    =>true
                      ) ;                    
        $this->load->library('upload' ,$config) ;
        
        if($this->input->post('submit')){    
        
            if(!$this->upload->do_upload()){
                $page['error']=$this->upload->display_errors() ;            
                $page['main_content']='upload_view' ;
                $this->load->view('includes/template' ,$page) ;
            }
            else{
                $page['is_ok']=$this->upload->data() ;
                $user_id=$this->session->userdata('user_id') ;
                $chemin='uploads/'.$page['is_ok']['orig_name'] ;
                
                $this->forum_model->update_pic($chemin ,$user_id) ;
                
                $page['main_content']='upload_view' ;
                $this->load->view('includes/template' ,$page) ;
            }
        }
        else{
        $page['main_content']='upload_view' ;
        $this->load->view('includes/template' ,$page) ;
        }
    }
    else{
        redirect($this->index()) ;
    }    
}
so on the column on my db thee's the path to the pic but when i ty to display it on a view like this
Code:
echo '< img src='. $ligne->pic .' / >'
i guess its an error of path that im makin and ive tried many things and gave up , i've gave a look to that tut abt uploadin on nettus but i saw the guy usin the APPPATH even his folder in same scale as application

tnx in advance
#2

[eluser]kosaidpo[/eluser]
okay i solved it by usin base_url
like this $chemin=base_url() .'uploads/'.$page['is_ok']['orig_name'] ;




Theme © iAndrew 2016 - Forum software by © MyBB