Upload path on Codeigniter returns "the upload path doesn't seem to be valid" Upload path on Codeigniter returns "the upload path doesn't seem to be valid" codeigniter codeigniter

Upload path on Codeigniter returns "the upload path doesn't seem to be valid"


Question, you tried realpath and APPPATH seperately?

In Codeigniter APPPATH points to the application folder.

Example: (place your folder outside the application folder, just saying if you did not do that way) let's say the folder where we want to place the files called images.

So what you need to do is to combine realpath() and APPPATH

$image_path = realpath(APPPATH . '../images');

and pass it to your config

$config['upload_path'] = $image_path;


Create your file upload directory say uploads outside of application directory or at the root directory of CI, and set the upload path as follows:-

$config['upload_path'] = realpath(FCPATH.'uploads');

FCPATH: Path to the front controller where index.php exists (root of CI)

The above code runs on both server and local.


This is how file uploading is done in CI

$cat_image_name = $_FILES["cat_image"]["name"] ; //file uploading params$config['upload_path'] = './uploaded_files/categories';$config['allowed_types'] = 'gif|jpg|png';$config['file_name'] = $image_id."_ipad";$config['remove_spaces'] = TRUE;//Loading Library - File Uploading$this->load->library('upload', $config);//Upload the image(Ipad)if (!empty($cat_image_name)) {  $this->upload->do_upload('cat_image');  $data = array('upload_data' => $this->upload->data());  $category_image_ipad = $data['upload_data']['file_name'];  $img_extension = $data['upload_data']['file_ext'];}