Welcome Guest, Not a member yet? Register   Sign In
Unable to upload a file outside of the webapp folder
#1

[eluser]maikens[/eluser]
Hi, I am trying to get my application to allow me to upload a file to a folder in /var/www. I have tracked the problem in the Upload class to a call to is_dir returning false. The pertinent code is:

Code:
$config['upload_path'] = '/var/www/path/to/folder/';
$this->load->library('upload', $config);

// ...

if($this->is_post()) { // function in MY_Controller that checks for post request
  if($this->upload->do_upload()) {
    // do stuff
  }
  else {
    $this->upload->display_errors();
  }
}
(I've omitted the irrelevant bits)

The error that is being encountered is 'upload_no_filepath'. The reason is that is_dir is returning false for '/var/www/path/to/folder/'.

I have set permissions for this folder with chmod.

Any suggestions? Seems I'm missing something fundamental.

[/code]




Theme © iAndrew 2016 - Forum software by © MyBB