$config[\'upload_path\'] = site_path().\'photos/\';
$config[\'allowed_types\'] = \'gif|jpg|png|jpeg\';
$config[\'max_size\'] = \'2048\';
$this->load->library(\
Hi on server you can connect with filezilla and right click on folder and change File Attributes
I know this has already been answered. Even I had difficulty trying to upload files. But in my case the issue was that I had the CodeIgniter application in a folder outside of /var/www and the index page in the www folder (mainly as a security measure).
The uploads folder should be in the /var/www folder that contains the index.php file. This is what I had to do. The next thing is to give 777 permissions to the uploads folder.
There's only a few reasons for this error to occur:
site_path().'photos/'
does not exist, try running is_dir()
to ensure that it does.is_writable()
to make sure.Beyond that, there is no explanation I can think of. Here is the CI code that validates the path (part of the Upload class):
public function validate_upload_path()
{
if ($this->upload_path == '')
{
$this->set_error('upload_no_filepath');
return FALSE;
}
if (function_exists('realpath') AND @realpath($this->upload_path) !== FALSE)
{
$this->upload_path = str_replace("\\", "/", realpath($this->upload_path));
}
// This is most likely the trigger for your error
if ( ! @is_dir($this->upload_path))
{
$this->set_error('upload_no_filepath');
return FALSE;
}
if ( ! is_really_writable($this->upload_path))
{
$this->set_error('upload_not_writable');
return FALSE;
}
$this->upload_path = preg_replace("/(.+?)\/*$/", "\\1/", $this->upload_path);
return TRUE;
}
Per your comments, try this instead and let's see what happens before moving to the next step of debugging:
$config['upload_path'] = './community/photos/';
i think problem can be solve by using
$config['upload_path'] ='./photos/';
instead of
$config['upload_path'] = site_path().'photos/';