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);

我收到错误说 fclose 正在使用二进制文件,谁能告诉我解决方案是什么,我无法理解 ci 更新功能。我需要在不更改其他内容的情况下更新表中的图像路径。

4

1 回答 1

0

您必须检查文件是否正确创建。请添加以下检查:

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

行后:

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

如果您现在收到消息,请验证生成的文件名和权限。

于 2014-04-11T08:07:38.847 回答