FETCHING ID of the user who posted the file and post it in the database

I am trying to upload profile pictures for my users using code igniter.the syntax for thposting the image in the file systeme is quite ok all i need to know =now is how can i add a userid to each specific image.i tried using the code below but it returns 0 as the user ID

function seekerImageStore()  
         {   $user = $this->session->userdata('myuserid_vipajijobs');
              $config['upload_path'] = './uploads/seekerimages';  
              $config['allowed_types'] = 'jpg|jpeg|png|gif';  
              $this->load->library('upload', $config);  
                  $error =  $this->upload->display_errors(); 
                  echo json_encode(array('msg' => $error, 'success' => false));
              {   $user = $this->session->userdata('myuserid_vipajijobs');
                  $data = $this->upload->data(); 
                   $insert['name'] = $data['file_name'];

                   $getId = $this->db->insert_id();   

                   $arr = array('msg' => 'Image has not uploaded successfully', 'success' => false);

                       $arr = array('msg' => 'Image has been uploaded successfully', 'success' => true);



Leave a Reply

Your email address will not be published. Required fields are marked *