I am trying to get files to upload using cakephp
I am currently using a tutorial but have come across some errors, especially with the move-uplaoded-file.
Error : Indirect modification of overloaded property UploadsController::$data has no effect
I see that my upload does actually create an array with details of the information in it, it just doesn't pass it to the database or move the tmp file.
Here is my uploading function:
function uploadFile() {
$file = $this->data['Upload']['file'];
if ($file['error'] === UPLOAD_ERR_OK) {
$id = String::uuid();
if (move_uploaded_file($file['tmp_name'] , APP . 'uploads'.DS.$id)) {
$this->data['Upload']['uploadID'] = $id;
$this->data['Upload']['fileName'] = $file['name'];
$this->data['Upload']['fileSize'] = $file['size'];
$this->data['Upload']['fileType'] = $file['type'];
return true;
}
}
return false;
}
Any help would be great, thanks!