发布文件并将其发布到数据库中的用户的FETCHING ID

我正在尝试使用codeigniter为用户上传个人资料图片。将图像发布到文件系统中的语法还可以,我需要知道如何为每个特定图像添加userid。我尝试使用下面的代码,但它返回0作为用户ID

function seekerImageStore()  
    {  
         if(isset($_FILES["image_file"]["name"]))  
         {   $user = $this->session->userdata('myuserid_vipajijobs');
              $config['upload_path'] = './uploads/seekerimages';  
              $config['allowed_types'] = 'jpg|jpeg|png|gif';  
              $this->load->library('upload',$config);  
              if(!$this->upload->do_upload('image_file'))  
              {  
                  $error =  $this->upload->display_errors(); 
                  echo json_encode(array('msg' => $error,'success' => false));
              }  
              else 
              {   $user = $this->session->userdata('myuserid_vipajijobs');
                  $data = $this->upload->data(); 
                  $insert['name'] = $data['file_name'];
                  $this->db->insert('images',$insert);
                  $pic=$this->input->post('image_file');
                  $this->db->insert('images',['user'=>$user,'name'=>$pic]);
                  $getId = $this->db->insert_id();
                  $arr = array('msg' => 'Image has not uploaded successfully','success' => false); 
                  if($getId){
                       $arr = array('msg' => 'Image has been uploaded successfully','success' => true);

                  }  

         }  
    }
nancy8888521 回答:发布文件并将其发布到数据库中的用户的FETCHING ID

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3133176.html

大家都在问