2010-05-18 9 views
1

codeigniters 업로드 클래스로 한 번에 두 개의 파일 (두 개의 파일 필드)을 업로드하려고합니다. 필드 이름 codeigniter를 제공 했음에도 불구하고 두 번째 필드에 오류가 발생합니다.한 번에 두 파일 업로드

저는 codeigniter, php 또는 html의 제한 사항입니까? 아니면 단순히 incorectly 클래스를 사용하고 있습니까? 나는 새로운 파일을 업로드 여기

The filetype you are attempting to upload is not allowed. 

내 두 가지 기능

function upload_image() { 
    $thumb_size = 94; 
    $config['upload_path'] = './assets/uploads/images/'; 
    $config['allowed_types'] = 'jpg|png|gif'; 
    $config['max_size'] = '2048'; 
    $config['file_name'] = 'video_' . rand(999999, 999999999); 
    $this->load->library('upload', $config); 

    if (!$this->upload->do_upload('image_file')) { 
     $error = array('error' => $this->upload->display_errors()); 
     return $error; 
    } else { 

function upload_video() { 


    $config['upload_path'] = './assets/uploads/videos/'; 
    $config['allowed_types'] = 'flv'; 
    $config['max_size'] = '0'; 
    $config['file_name'] = 'video_' . rand(999999, 999999999); 
    $this->load->library('upload', $config); 
    if (!$this->upload->do_upload('video_file')) { 
     $error = array('error' => $this->upload->display_errors()); 
     return $error; 
    } else { 

답변

4

그것은 $this->load->library('upload');으로 클래스를 로딩하는 일이다 다음 $this->upload->initialize($config);마다 사용 :

$this->upload->do_upload('video_file') 

$this->upload->do_upload('image_file') 

는 이미지 필드에이를 생성 .

+0

다른 변수의 이름과 비디오 파일의 이름 같은 다른 파일의 이름을 함께 가져 오는 방법은 무엇입니까? –

관련 문제