The download path is not valid. "Downloading the Codeigniter file

$config['upload_path'] = './uploads/'; $config['allowed_types'] = 'doc|docx'; $config['max_size'] = '400'; $config['max_width'] = '1024'; $config['max_height'] = '768'; $this->load->library('upload', $config); if ( ! $this->upload->do_upload()) { $error = array('error' => $this->upload->display_errors()); $this->load->view('upload_form', $error); } else { $data = array('upload_data' => $this->upload->data()); $this->referral_model->postCVReferralInfo($m_id, $emp_id , $job_id, $name, $age , $gender,$country_id, $mobile, $email, $summary, $workExp, $education, $qualification, $offer, $sb_id); header('location:'.$this->config->base_url().'index.php/member/referSuccess'); exit; } ' 

If I try to download the doc file, I get the error message "The download path is not true." I replaced the path with an absolute path, and then I get this error. Please suggest me how I can solve the problem.

+4
source share
5 answers

Usually the problem occurs when calling $this->load->library('upload', $config) , it may not load the configuration parameters, so try adding the following statement after loading the load library.

 $this->upload->initialize($config); 
+12
source

Same problem ... solved with

 $this->upload->initialize($config); 

And it's better not to use .... BASE_URL in $CONFIG['UPLOAD_PATH']

+4
source

never use base_url () in $ CONFIG ['UPLOAD_PATH'],

Note the dot before the backslash preceding your download folder. Therefore, your boot path should look like this:

  $CONFIG['UPLOAD_PATH'] = './assets/uploads/ 
+1
source

change the code to this $config['upload_path'] = 'uploads';

0
source

better to use:

 $config["upload_path"] = $_SERVER['DOCUMENT_ROOT']."/your/desired/location/"; 
0
source

Source: https://habr.com/ru/post/1482139/


All Articles