0
    $result = $this->db->insert('user_reg', $user_data);
    if($result)
    {
       $userid = $this->db->insert_id();
       $this->db->where('user_id', $userid);
       $user_data =  $this->db->get('user_reg')->row();
       // $userid = $this->db->insert_id();

       chmod('./upload/', 0777);
       $path   = './upload/'.$userid;

       $binary=base64_decode($user_profile_img);

       header('Content-Type: bitmap; charset=utf-8');

       $img_path=$path.'/profile_image.jpg';

       $file = fopen($img_path, 'wb');

       fwrite($file, $binary);

       $Gimage = mysql_real_escape_string(base_url($path.'/profile_image.jpg'));

       fclose($file);

i am getting error saying fclose is using binary can anyone tell what is the solution and i am not able to understand with ci update function.i need to update image path in the table without changing other contents.

andy
  • 53
  • 2
  • 11

1 Answers1

0

You have to check that the file is created correctly. Please add the following check:

if (!$file) die ('Error opening file for writing');

after the line:

$file = fopen($img_path, 'wb');

and if you get the message now, verify the generated file name and permissions.