public function FileBase::save in Forena Reports 8
Same name and namespace in other branches
- 7.5 src/File/FileBase.php \Drupal\forena\File\FileBase::save()
Save a file into the report directory.
Parameters
string $filename: FIle to save
string $data: Report definition.
File
- src/
File/ FileBaseOld.php, line 357 - FileSystemBase.inc File toolbox for manipulating files contained tn the report directory.
Class
Namespace
Drupal\forena\FileCode
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 {
$this
->error(t('Insufficient privileges to write file.'));
}
}