본문 바로가기

프로그래밍/PHP

코드이그나이터 파일 업로드

$config['upload_path'] = './uploads/order/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '0'; // 서버 설정에 따라 적용
$config['max_width'] = '0'; //
$config['max_height'] = '0'; //

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

// 이미지 1
if ( ! $this->upload->do_upload('company_license_img'))//company_license_img 업로드 파일의 name 속성

{
$error = array('error' => $this->upload->display_errors());
//echo "error===" .var_dump($error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->upload->data('file_name');        
//echo "sssss===" .var_dump($data);
}