You are here

protected function elFinderVolumeDrupal::_mkfile in elFinder file manager 8.2

Same name and namespace in other branches
  1. 6.2 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::_mkfile()
  2. 7.3 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::_mkfile()
  3. 7.2 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::_mkfile()

Create file

@author Alexey Sukhotin

Parameters

string $path parent dir path:

string $name new file name:

Return value

bool

File

src/Controller/elFinderVolumeDrupal.php, line 101
elFinder driver for Drupal filesystem.

Class

elFinderVolumeDrupal
@file

Code

protected function _mkfile($path, $name) {
  $path = $path . DIRECTORY_SEPARATOR . $name;
  $uri = $this
    ->drupalpathtouri($path);
  if (!$this
    ->CheckExtension($this
    ->_drupalfileobject($path))) {
    return FALSE;
  }
  $newpath = file_unmanaged_save_data("", $uri);
  $file = $this
    ->_drupalfileobject($path);
  $file
    ->save();
  $this
    ->FileUsageAdd($file);
  if ($file
    ->id()) {
    return $path;
  }
  return FALSE;
}