2014-09-26 2 views
0

이 코드 블록은 내 로컬 컴퓨터에서 작동하지만 내 GoDaddy 서버에 업로드하면 작동하지 않으며 "업로드하려는 파일 형식이 허용되지 않습니다 . " 이 문제는 csv 및 xlsx 파일을 업로드하려고 할 때만 발생합니다. png 및 jpg는 아무런 문제가 없습니다.Codeignitor - 파일 업로드 및 GoDaddy

$filename = "classlist_".date("YmdHis").".csv"; 
    $config['upload_path'] = APPPATH. '../uploads/'; 
    $config['allowed_types'] = 'xlsx|xls|jpg|png|csv'; 
    $config['max_size'] = '1000'; 
    $config['max_width'] = '1024'; 
    $config['max_height'] = '768'; 

    $this->load->library('upload', $config); 

    if (!$this->upload->do_upload()) 
    { 
     print_r($this->upload); 

     echo "error<br/>".$this->upload->display_errors(); 
     exit; 
    } 
    else 
    { 
     exit; 
+0

오류를? 모든 고지 사항, 뭔가? – Naruto

+0

GoDaddy 서버에서 사용중인 Codeignitor 버전은 무엇입니까? – Vidhi

+0

@Naruto CI 출력 이외의주의 사항이나 오류가 없습니다. – Mikerizzo

답변

0

이것은 특정 파일 형식에 대한 서버 구성의 문제입니다. 즉, xlsx에 대해 서버에서 제공하는 파일 형식이 mimes.php 파일의 $mimes 변수에 없습니다. 파일 mimes.phpapplication/config/mimes.php에 있습니다. $_FILES 변수를 인쇄하고 $ mimes 변수에 표시되는 해당 MIME을 추가하십시오.

또 다른 방법은 htaccess로 파일에 그 마임을 강제하는 것입니다 :

AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx 
AddType application/excel xls 
AddType text/x-comma-separated-values csv 
+0

주사위가 없습니다. 여전히 작동하지 않았습니다. – Mikerizzo

+0

'$ this-> upload-> do_upload()'파일 다음에'print_r ($ _ FILES);'을 출력하면 어떻게됩니까? – machineaddict

+0

그리고 마임을 지정해야하므로 물론 작동하지 않았습니다. 그것은 작동 코드가 아닌 예제입니다! – machineaddict

관련 문제