[eluser]eedfwChris[/eluser]
Code:
/**
* ----------------------------------------------------
* Validate Form
* ----------------------------------------------------
* Validates the RTD search form.
*
*/
function _validate_form()
{
$this->load->library('validation');
/* Set field names */
$fields['name'] = "Site/Community Name";
$fields['state'] = "State";
//$fields['userfile'] = "CSV File";
$this->validation->set_fields($fields);
/* Set validation parameters */
$rules['name'] = "required|max_length[50]";
$rules['state'] = "required|max_length[2]|min_length[2]";
//$rules['userfile'] = "required";
$this->validation->set_rules($rules);
/* Run validation */
if ($this->validation->run() == FALSE)
{
$this->view->set('validation_error', $this->validation->error_string);
$this->view->part('body', 'rtd/rtd_search_form_view');
}
else
{
$this->_validate_csv();
}
}
/**
* ----------------------------------------------------
* Validate CSV
* ----------------------------------------------------
* Validates the uploaded CSV file to ensure that the proper type of CSV is uploaded (or it is a CSV at all)
*
*/
function _validate_csv()
{
$config['upload_path'] = './rtd_tmp/';
$config['allowed_types'] = 'csv';
$this->load->library('upload', $config);
if ($this->upload->do_upload() == FALSE)
{
$this->view->set('validation_error', $this->upload->display_errors());
$this->view->part('body', 'rtd/rtd_search_form_view');
return FALSE;
}
else
{
return TRUE;
}
}
I am getting a "The upload path does not appear to be valid." error...
Where exactly does codeigniter want the upload directory? I have my file path like this
-System
---application
------controller
---rtd_tmp
-Webroot
Sorry.... Figured it out I needed to use ../rtd_tmp/