I\'m new in cakephp and i\'m trying to create a simple file upload with cakephp 2.3 here is my controller
public function add() {
if ($this->request-&
..ensure the documents directory already exists and check you have permissions to write to it? If it doesnt exist create it or in your code check if it exists and create it if it is not there: example of code that will check if the directory is there or not and create it then upload the file-
$dir = WWW_ROOT. DS . 'documents';
if(file_exists($dir) && is_dir($dir))
{
move_uploaded_file($this->data['posts']['doc_file']['tmp_name'],$filename);
}
elseif(mkdir($dir,0777))
{
move_uploaded_file($this->data['posts']['doc_file']['tmp_name'],$filename);
}
also ensure you are not uploading a blank/empty file - it might fail.