I have written code on image upload, but it is not working in byethost server. I created "uploads/products"
directory under root location of server, the folder is also writable, but still it is not working. Please help.
I turned on error logging for the application. If I visit "application/logs"
directory's log file following error is shown.
ERROR - 2018-03-25 00:47:08 --> 404 Page Not Found: /index
ERROR - 2018-03-25 00:58:24 --> The upload path does not appear to be valid.
Picture of image upload directory in byethost server
Code of my Product Controller.
if(isset($_FILES['productimage']['name'])){
$filename = $_FILES['productimage']['name'];
$config['file_name'] = $filename;
$config['upload_path'] = realpath(FCPATH.'uploads/products/');
$config['allowed_types'] = 'jpg|jpeg|png';
$config['remove_spaces'] = TRUE;
$config['encrypt_name'] = TRUE;
$config['min_width'] = 360;
$config['min_height'] = 360;
$config['max_width'] = 360;
$config['max_height'] = 360;
$this->upload->initialize($config);
if($this->upload->do_upload('productimage')){
$uploadeddata = $this->upload->data();
$data['image'] = $uploadeddata['file_name'];
}else{
$this->session->set_flashdata('error', $this->upload->display_errors());
$result = array("status"=>false, "message"=>$this->upload->display_errors());
}
}