You are here

public function FileBase::delete in Forena Reports 8

Same name and namespace in other branches
  1. 7.5 src/File/FileBase.php \Drupal\forena\File\FileBase::delete()

Delete a file from the directory.

Parameters

string $filename: Name of file to delete

Return value

boolean TRUE indicates success

File

src/File/FileBaseOld.php, line 377
FileSystemBase.inc File toolbox for manipulating files contained tn the report directory.

Class

FileBase

Namespace

Drupal\forena\File

Code

public function delete($filename) {
  $path = $this->dir . '/' . $filename;
  $dir = getcwd();
  $do = TRUE;
  if (file_exists($path) && is_writeable($path) && is_writable(dirname($path))) {
    $info = pathinfo($path);
    chdir(dirname($path));
    $do = unlink($info['basename']);
    chdir($dir);
  }
  return $do;
}