I again need your help!
My codeigniter upload function doesn't work correctly, it's returning the message:"invalid upload path".
My form is a customer register form, with personal data and a field to upload personal files, if form validation is true does the upload.
Follows part of my controller code that is responsible for upload:
//MAKE THE UPLOAD DIR BASE WITH PREVIOUS DEFINED NAME
mkdir("./uploads/$dirname", 0777);
//UPLOAD CUSTOMERS FILES
$config['upload_path'] = "./uploads/$dirname";
$config['allowed_types'] = 'gif|jpg|png|pdf';
$config['max_size'] = 2048;
$config['max_width'] = 1920;
$config['max_height'] = 1280;
$this->load->library('upload', $config);
if (!$this->upload->do_upload('userfile')) {
$error = array('error' => $this->upload->display_errors());
//SET SESSION MESSAGE FOR THE USER
$this->session->set_flashdata('upload',$error);
} else {
$data = array('upload_data' => $this->upload->data());
//SET SESSION MESSAGE FOR THE USER
$this->session->set_flashdata('upload','Upload success!');
}
My view return success to the data in the database and error to upload.
Below my directory structure:
web_administration
|
|-application
|-src
|-uploads
|
|-customer_directory
|
|-user_guide
Aucun commentaire:
Enregistrer un commentaire