0
我有一个base64编码的图像字符串$imgcode
这是一个base64编码图像,我想用codeigniter上传它。如何在codeigniter中上传base64编码的图像
下面是我在做什么 -
$this->Photo_model->uploadPhoto($userdir,base64_decode($imgCode)
的uploadPhoto功能是这样的:
public function uploadPhoto($path,$img){
//echo $img;
//echo $path;
$config['upload_path'] = $path;
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '1000';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if(!$this->upload->do_upload($img)){
return FALSE;
}
else{
$fInfo = $this->upload->data();
$this->createThumbnail($fInfo['file_name'],$fInfo['file_path']);
$this->load->model('Photo_model');
if($this->Photo_model->savePhotoInfo($fInfo['file_name'],$path)){
return true;
}
else{
return false;
}
}
}
的图像中,无法上传。这是正确的方法吗?
字符串我删除了实际的字符串,几乎崩溃我的浏览器,当我试图对其进行编辑。 –