Sunday, August 25, 2013

CodeIgniter: "The upload path does not appear to be valid" error

The "The upload path does not appear to be valid." error when using the CodeIgniter upload library can be quite puzzling. The problem usually occurs when a call to "$this->load->library('upload', $config)" doesn't load the configuration settings, so adding the following statement after loading the upload library usually sorts out the problem (assuming your configuration array is named $config):
$this->upload->initialize($config);

You can also choose to create an upload.php file within the config directory and place the $config array within that file instead of the call to the initialize function.