2012-03-30 61 views
0

下面的函數不斷告訴我,即使我上傳一個PDF文件,我上傳了錯誤的文件類型 - 任何人都可以提出什麼問題?Codeigniter問題與上傳(V2.1) - (錯誤的文件類型)

// output of the var_dump's 
$this->upload->data() (array) 
file_name brochure.pdf 
file_type [empty string] 
file_path D:/Shared/Web Sites/site-dev/documents/ 
full_path D:/Shared/Web Sites/site-dev/documents/brochure.pdf 
raw_name brochure 
orig_name [empty string] 
client_name brochure.pdf 
file_ext .pdf 
file_size 369498 
is_image FALSE 
image_width [empty string] 
image_height [empty string] 
image_type [empty string] 
image_size_str [empty string] 

$data (array) 
error 

The filetype you are attempting to upload is not allowed. 

function do_upload() 
{ 
    $config['upload_path'] = './documents/'; 
    $config['allowed_types'] = 'pdf|doc'; 

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

    if (! $this->upload->do_upload('File')) 
    { 
     $data = array('error' => $this->upload->display_errors()); 
        var_dump($this->upload->data()); 
        var_dump($data);exit; 
     //$this->load->view('upload_form', $error); 
    } 
    else 
    { 
     $data = array('upload_data' => $this->upload->data()); 

     //$this->load->view('upload_success', $data); 
    } 

    return $data; 
} 
+1

你能普萊舍嘗試'轉儲($這個 - > upload-> FILE_TYPE);' – safarov 2012-03-30 09:55:24

+0

固定 - 有上傳類的問題2.1 我按照這裏的說明修改上傳庫和所有工作:) 感謝您的快速響應:) http://stackoverflow.com/questions/7495407/uploading-in-笨最文件類型 - 你 - 是 - 試圖對上載的,不可─ allo – Zabs 2012-03-30 10:00:25

+0

好的,Congratz =) – safarov 2012-03-30 10:01:40

回答

0

固定 - 問題2.1(見上面我的帖子)