2012-01-04 5 views
0

을 사용하여, 나는 form_open_multipart()을 사용하고, 내가 가진 : 내가하려고 할 때,업로드 파일 이미지 내보기에 CI

$config['upload_path'] = './resources/uploads/'; 
$config['allowed_types'] = 'jpg|gif|png|bmp|jpeg'; 
$config['max_size'] = '0'; 
$config['max_width'] = '0'; 
$config['max_height'] = '0'; 
$this->load->library('upload', $config); 

if(!$this->upload->do_upload('user_photo')) { 
echo $this->upload->display_errors('<p>', '</p>'); 
} else { 
echo "<pre>"; print_r($this->upload->data()); 
} 

을하지만 :

<input type="file" name="user_photo" style="margin-top: 5px;" /> 

내가 이렇게 내 컨트롤러에서 구성을 파일 형식 * .jpg로 이미지 파일 업로드, 다음과 같은 오류가 있습니다. The file type you are attempting to upload is not allowed.
구성에 문제가 있습니까? 덕분에 .

+0

어떤 CodeIgniter 버전을 사용하고 있으며 어떤 버전의 PHP를 사용하는 데 문제가있는 웹 서버입니까? – stealthyninja

+0

을 사용하고 있습니까? 구성에서 $ config [ 'file_name']? –

+0

@stealthyninja CodeIgniter 2.1.0 및 PHP 5.3.0을 사용하고 있습니다. – Praditha

답변

0

웹 서버가 PHP v5.2.x를 사용하고 있고 CodeIgniter 2.1.0을 사용하고 있다면 CodeIgniter 2.0.3으로 다시 다운 그레이드해야하며 업로드 문제는 없어집니다.

CodeIgniter의 2.1.0에서이 문제를 생성 코드의 유죄 라인은 /system/libraries/Upload.php에서

$this->file_type = @mime_content_type($file['tmp_name']); 

입니다. 자세한 내용은 CodeIgniter open issues 목록을 참조하십시오.

+1

예, CodeIgniter 2.0.3에서 사용해 보았습니다. 감사,. – Praditha

관련 문제