$img = $this->input->post('img'); $img = str_replace('data:image/png;base64,', '', $img); $img = str_replace(' ', '+', $img); $data = base64_decode($img); $file = md5(uniqid()).'.png'; file_put_contents('/var/www/html/comfort.vaillant.com.cn/byebye/uploads/'.$file, $data);