我必须上传我从android应用程序收到的base64编码图像.我正在使用php codeigniter框架.在搜索论坛时,此链接上的问题如何在codeigniter中上传base64encoded图像与我的相同,但解决方案对我不起作用.
这是我写的代码:
private function _save_image() {
$image = base64_decode($_POST['imageString']);
#setting the configuration values for saving the image
$config['upload_path'] = FCPATH . 'path_to_image_folder';
$config['file_name'] = 'my_image'.$_POST['imageType'];
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = '2048';
$config['remove_spaces'] = TRUE;
$config['encrypt_name'] = TRUE;
$this->load->library('upload', $config);
if($this->upload->do_upload($image)) {
$arr_image_info = $this->upload->data();
return ($arr_image_info['full_path']);
}
else {
echo $this->upload->display_errors();
die();
}
}
Run Code Online (Sandbox Code Playgroud)
我收到"你没有选择要上传的文件"
谢谢你的时间.