Answers for "remove file cakephp 2"

PHP
1

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;
}
Posted by: Guest on October-12-2021

Browse Popular Code Answers by Language