我得到了:
500 Internal server error
通过 AJAX 上传图片。到达时:
$this->upload->do_upload('filename');
它会产生此错误。我搜索每个地方但没有找到解决方案。
我的代码是:
foreach($_FILES as $key_img=>$row_img){
if(!empty($row_img['name'])){
$image_path = './assets/images/';
$config['upload_path'] = $image_path;
$config['allowed_types'] = "gif|jpg|png";
$config['max_size'] = '1000';
$this->load->library('upload', $config);
if (!$this->upload->do_upload($key_img))
{
$upload_error = array('error' => $this->upload->display_errors());
}
else
{
$data = array('upload_data' => $this->upload->data());
$userfile = $data['upload_data']['file_name'];
}
}
}
在控制台中报告错误,而网络选项卡上没有响应。
答案 0 :(得分:4)
codeigniter 3.1.2 upload.php有问题, 我有php7但我得到500错误。 我的解决方案是下载codeigniter 3.0.6并复制文件upload.php并将其粘贴到系统/库