if($_FILES['file_info']['name']){
$config['upload_path'] = $GLOBALS['path'];
$config['file_name'] = strtolower($_FILES['file_info']['name']);
$config['allowed_types'] = 'gif|jpg|png|txt|xlsx|xls|ppt|pptx|doc|pdf|hwp';
$config['max_size'] = '10240'; //10mb
$config['max_filename'] = '100';
$config['file_field'] = 'file_info';
$config['remove_spaces'] = FALSE;
$this->load->library('upload', $config);
if (!$this->upload->do_upload($config['file_field'])) {
$file_error = $this->upload->display_errors();
}else{$file_error = '';}
}
if($file_error){
echo $_FILES['file_info']['type'];
$file_error = str_ireplace("</p>","",str_ireplace("<p>","",$file_error));
echo "<script type='text/javascript'>alert('$file_error');history.go(-1);</script>";
return FALSE;
}
위와같이 파일 업로드를 구현합니다.
다른 확장자는 아무런 에러 없이 잘 올라가는데 hwp 파일만 올리면
'업로드하려는 파일 유형은 허용되지 않습니다.' 라는 에러가 나오네요.
에러 에코 출력물에도 application/haansofthwp 라고 나오는데 말이죠..
mimes.php 파일에도 처음엔 application/haansofthwp 하나로 시작해서
'hwp' => array('application/haansofthwp', 'application/x-hwp', 'application/unknown', 'application/msword', 'application/octet-stream', 'application/zip', 'text/plain', 'text/xml'),
와 같이 온갖 설정 죄다 적어줘도 안되네요..
pptx는 'application/vnd.openxmlformats-officedocument.presentationml.presentation' 적어주고 바로 적용했는데 말이죠..
php 버전은 5.4.23 입니다.
도움말씀 부탁드립니다..
이 함수로 서버에 파일 올려놓고 출력해보세요.