CI 묻고 답하기

제목 파일업로드에서 무슨문제있지 모르겠습니다 좀 알려주세요 초보입니다
글쓴이 일성 작성시각 2014/06/27 20:49:12
댓글 : 1 추천 : 0 스크랩 : 0 조회수 : 14570   RSS
public function up() {
    $this->page();
        $config['upload_path'] = './assets/img/';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_size'] = '1000';
        $config['max_width'] = '10240';
        $config['max_height'] = '7680';
        
        $config['encrypt_name'] = true;//파일이름 암호화
        
        $this -> load -> library('img', $config);
        
        $arr = array(
            'no'=> $this->input->post('no'),
            'name'=> $this->input->post('name'),
            'date'=> $this->input->post('date'),
            'price'=> $this->input->post('price'),
            'time'=> $this->input->post('time'),
            'recipe'=> $this->input->post('recipe'),
            'win'=> $this->input->post('win'),
            'img'=> $data['file_name']
        
        );
        if ($this -> upload -> do_upload()) {
            redirect(site_url('blog1'), "refresh");
        
        //$data =$this -> upload -> data();
        //$this->load->view('blog1_view',$data);
        }
        else{
            $this->load->view('blog1_view',$data);
        }
    }
 이것은 controller이고
function up($arr) { 
        $result =  $this->db->query("INSERT INTO `recipe`(no, name, date, price,time,recipe,img,win) VALUES({$arr['no']},'{$arr['name']}',{$arr['date']},{$arr['price']},{$arr['time']},'{$arr['recipe']}',{$arr['img']},{$arr['win']});");
        if ($result) {
            return TRUE;

        }
        return FALSE;
    }
이건 models 이고 
이 걸 그대로 하면 
An Error Was Encountered

Unable to load the requested class: img 
이런 글이 나오네요 뭐가 문제있지 모르겠습니다  자세하게 좀 알려주세요 뭐가문제인지 

 다음글 여러개의 데이타베이스를 왔다갔다 해야하는 환경 ??? (1)
 이전글 코드이그나이터 페이스북 로그인 연동 질문 드려요~ (2)

댓글

letsgolee / 2014/06/27 23:17:52 / 추천 0
http://codeigniter-kr.org/user_guide_2.1.0/libraries/image_lib.html

링크를 참조하세요.
$this->load->library('image_lib', $config);

그런데 대충 소스를 보니  파일 업로드이네요? 이게 전체 코드라면 image_lib을 사용하지 않는 것이 되니까 전체 코드는 아니겠죠?