remove file cakephp 2
public function remove_file ($file) {
$removed = array(
'status' => false, 'message' => 'Fail to removed file', 'params' => array()
);
$file = new File(WWW_ROOT . $file, false, 0777);
if ($file->delete()) {
$removed = array(
'status' => true, 'message' => 'Removed file successfully.',
'params' => array(
'path' => $file
)
);
}
return $removed;
}