You are here

public function FileBase::save in Forena Reports 7.5

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

Save a file into the report directory.

Parameters

unknown_type $filename:

unknown_type $data:

File

src/File/FileBase.php, line 349
FileBase.inc File toolbox for manipulating files contained tn the report directory.

Class

FileBase

Namespace

Drupal\forena\File

Code

public function save($filename, $data) {
  $path = $this->dir . '/' . $filename;
  $this
    ->verifyDirectory($filename);
  if (is_writable($path) || !file_exists($path) && is_writable(dirname($path))) {
    file_put_contents($path, $data);
  }
  else {
    Frx::error(t('Insufficient privileges to write file.'));
  }
}