I have a controller with the method 'do_upload' which should upload an image to /img but instead I'm getting the following error:
http://localhost/img/
The upload path does not appear to be valid.
This is the method of the upload class.
public function do_upload(){
$config['upload_path']= "http://localhost/img/";
$config['allowed_types']= 'gif|jpg|png';
$config['max_size']='100';
$config['max_width']='1024';
$config['max_height']='768';
$this->load->library('upload',$config);
if(!$this->upload->do_upload()){
$errors=array('errors'=>$this->upload->display_errors());
echo $config['upload_path'];
$this->load->view('error',$errors);
}
else{
$data=array('upload_data'=> $this->upload->data());
$this->load->view('admin/admin');
}
}
The file permissions are set to the following (to test this works!):
drwxrwxrwx
However, if I direct my browser to http://localhost/img/
I am able to view the contents of the directory so I don't think it's a permission issue. Is there something I'm doing wrong?