JPG的工作很好,PNG上传失败。
我不能为我的生活找出原因。
我正在使用CodeIgniter 2.3.2。
MIMES.php
'jpg' => array('image/jpeg', 'image/pjpeg'),
'png' => array('image/png', 'image/x-png'),
型号代码:
$new_file_name = $this->db->insert_id();
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'].'/images/mainimg/';
$config['file_name'] = $new_file_name;
$config['allowed_types'] = 'png|gif|jpg|jpeg';
$this->load->library('upload', $config);
$this->upload->initialize($config);
if(! $this->upload->do_upload('Image'))
{
echo $config['upload_path'] . $this->upload->file_name;
$errors = $this->upload->display_errors();
echo $errors;
exit(-1);
}
错误:
/Users/Me/Documents/Project/html/images/mainimg/317.png
The filetype you are attempting to upload is not allowed.
答案 0 :(得分:-2)
$config['allowed_types'] = 'png|gif|jpg|jpeg|pjpeg|x-png'