2016-07-17 2 views
0

폴더에 이미지를 추가 할 수 없습니다. 이유를 모르겠습니다. 내 루트 폴더 안에 고객 폴더가 있습니다. 도움이 필요합니다.codeigniter에 이미지 폴더를 업로드 할 수 없습니다.

function add_new_successfully(){ 

$config['upload_path'] = site_url().'customer/'; 
$config['allowed_types'] = 'gif|jpg|jpeg|png'; 

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

$data['customer_name'] = $this->input->post('c_name'); 
$data['customer_email'] = $this->input->post('c_email'); 
$data['customer_pass'] = $this->input->post('c_pass'); 
$data['customer_country'] = $this->input->post('c_country'); 
$data['customer_city'] = $this->input->post('c_city'); 
$data['customer_contact'] = $this->input->post('c_contact'); 
$data['customer_address'] = $this->input->post('c_address'); 
$data['customer_image'] = $_FILES['userfile']['name']; 

$this->common_model->insert('customers',$data); 

$this->session->set_flashdata('page_added','<div class="n_ok"><p>Customer added</p></div>'); 

    redirect($_SERVER['HTTP_REFERER']); 
} 

답변

1

업로드 경로는 여기에서 설정하려고 URL 값이 아닙니다 :

이 내 컨트롤러 기능입니다. 이것은 파일 시스템에 대한 절대 또는 상대 경로입니다.

$config['upload_path'] = FCPATH.'customer/';//FCPATH is constant for file system path to root directory or better said path to location next to index.php file 

Docs.

+0

내 세부 정보는 데이터베이스에 업로드되지만 폴더는 변경되지 않습니다 ... $ config [ 'upload_path'] = site_url(). 'customer /'; $ config [ 'upload_path'] = FCPATH.'customer/'; 그러나 같은 문제 .... @ Tpjka –

+0

'upload_path'를 하나 변경하십시오. 나는 당신에게 제안했고 어떤 차이점이 있는지 말해줍니다. – Tpojka

+0

감사합니다 지금 작동 중입니다 ........ @ Tpojka –

0
$config['upload_path'] = './customer/'; 

그러나 프로젝트에 "고객"이라는 폴더가 있어야합니다.

관련 문제