You are here

protected function elFinderVolumeDrupal::_mkfile in elFinder file manager 7.2

Same name and namespace in other branches
  1. 8.2 src/Controller/elFinderVolumeDrupal.php \elFinderVolumeDrupal::_mkfile()
  2. 6.2 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::_mkfile()
  3. 7.3 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

inc/elfinder.drupalfs.driver.inc, line 106
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;
  }
  $file = file_save_data("", $uri);
  $this
    ->FileUsageAdd($file);
  if (isset($file->fid)) {
    return $path;
  }
  return FALSE;
}