CI 묻고 답하기

제목 파일 업로드 질문있습니다
카테고리 CI 2, 3
글쓴이 니로 작성시각 2017/05/18 15:08:49
댓글 : 7 추천 : 0 스크랩 : 0 조회수 : 14554   RSS
    		print_r($_FILES);

		if($this->upload->do_upload("userfile")){
			echo "a";
			print_r($this->upload->data());
		}

		exit;

 

$_FILES를 찍으면 

Array ( [userfile] => Array ( [name] => 25메가.wmv [type] => video/x-ms-wmv [tmp_name] => C:\xampp\tmp\php68CA.tmp [error] => 0 [size] => 26246026 ) )

 

이렇게 나오는데요

 

do_upload가 안되는거같은데.. 어떤걸 살펴야 할가요..?

$this->upload->data()만찍어봐도 아무것도 없어요
 다음글 base_url값을 상수로 지정하여 사용할수 없을까요? (2)
 이전글 CI 마이그레이션 기능중 시더 기능은 없나요? (2)

댓글

하늘치 / 2017/05/18 15:16:02 / 추천 0

CI 한글 메뉴얼에서 검색해보시면 원하시는 답을 얻으실 수 있습니다~

포럼의 첫 번째 메인 메뉴에 버전별로 있으니 참고하세요~

변종원(웅파) / 2017/05/18 15:16:58 / 추천 0
업로드 설정은 하신건가요? 매뉴얼에서 설정하기 참고하세요.
니로 / 2017/05/18 16:31:57 / 추천 0

아무리봐도 모르겠는데...

$this->upload->do_upload("userfile") 가 안되는 이유가 어떤게 있을까요..

config/upload폴더 생성해서 옵션들

$config['upload_path']    = $_SERVER["DOCUMENT_ROOT"] . '/webroot/upload';

$config['allowed_types'] = 'gif|jpg|png';
$config['overwrite'] = FALSE;
$config['max_size'] = 0;
$config['max_width'] = 0;
$config['max_height'] = 0;
$config['max_filename'] = 0;
$config['encrypt_name'] = TRUE;
$config['remove_spaces'] = TRUE;

넣고 autoload.php에서 $autoload['config'] = array('upload'); 이렇게 해두면 되는거 아닌가요...?

한대승(불의회상) / 2017/05/18 16:42:55 / 추천 0
니로 / 2017/05/18 17:07:41 / 추천 0

/* 업로드 설정 */
            $config['upload_path']   = $_SERVER["DOCUMENT_ROOT"] . '/webroot/upload/';
            $config['allowed_types'] = 'pdf|zip|jpeg|gif|jpg|png|xlsx|xls|doc|docx|ppt|txt';
            $config['overwrite']     = FALSE;
            $config['max_size']      = 51200;
            $config['max_width']     = 0;
            $config['max_height']    = 0;
            $config['max_filename']  = 0;
            $config['encrypt_name']  = TRUE;
            $config['remove_spaces'] = TRUE;

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

            if($this->upload->do_upload("userfile")){
                echo "a";
                print_r($this->upload->data());
            }else{
                echo $this->upload->display_errors();
            }

            exit;

 

이렇게 했는데도 안되는데.. 에휴.ㅠㅠ

한대승(불의회상) / 2017/05/18 17:14:31 / 추천 0

$config['allowed_types'] = 'pdf|zip|jpeg|gif|jpg|png|xlsx|xls|doc|docx|ppt|txt';

를 

$config['allowed_types'] = '*';

로 수정해서 테스트 해보세요.

하늘치 / 2017/05/18 19:34:07 / 추천 0

업로드 하시려는 파일의 확장자가 wmv 인가요?

그렇다면 $config['allowed_types'] 에 wmv 를 추가하시거나, 

한대승님 댓글처럼 해결하시면 됩니다. 

시간을 보니, 이미 해결하셨을 수도 있겠네요. ^^