Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FileSystem.php

function FileSystem::tempnam

Same name in this branch
  1. 11.1.x vendor/symfony/filesystem/Filesystem.php \Symfony\Component\Filesystem\Filesystem::tempnam()

Overrides FileSystemInterface::tempnam

1 call to FileSystem::tempnam()
FileSystem::saveData in core/lib/Drupal/Core/File/FileSystem.php
Saves a file to the specified destination without invoking file API.

File

core/lib/Drupal/Core/File/FileSystem.php, line 268

Class

FileSystem
Provides helpers to operate on files and stream wrappers.

Namespace

Drupal\Core\File

Code

public function tempnam($directory, $prefix) {
    $scheme = StreamWrapperManager::getScheme($directory);
    if ($this->streamWrapperManager
        ->isValidScheme($scheme)) {
        $wrapper = $this->streamWrapperManager
            ->getViaScheme($scheme);
        if ($filename = tempnam($wrapper->getDirectoryPath(), $prefix)) {
            return $scheme . '://' . static::basename($filename);
        }
        else {
            return FALSE;
        }
    }
    else {
        // Handle as a normal tempnam() call.
        return tempnam($directory, $prefix);
    }
}
RSS feed
Powered by Drupal