W3cubDocs

/Drupal 8

function drupal_dirname

drupal_dirname($uri)

Gets the name of the directory from a given path.

Deprecated

in Drupal 8.0.x-dev, will be removed before Drupal 9.0.0. Use \Drupal\Core\File\FileSystem::dirname().

Related topics

File interface
Common file handling functions.

File

core/includes/file.inc, line 1120
API for handling file uploads and server file management.

Code

function drupal_dirname($uri) {
  return \Drupal::service('file_system')->dirname($uri);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!file.inc/function/drupal_dirname/8.1.x