8.2.x file.inc drupal_basename($uri, $suffix = NULL)
8.0.x file.inc drupal_basename($uri, $suffix = NULL)
8.1.x file.inc drupal_basename($uri, $suffix = NULL)
8.3.x file.inc drupal_basename($uri, $suffix = NULL)
7.x file.inc drupal_basename($uri, $suffix = NULL)

Gets the filename from a given path.


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

Related topics

32 calls to drupal_basename()
color_library_info_alter in core/modules/color/color.module
Implements hook_library_info_alter().
color_scheme_form_submit in core/modules/color/color.module
Form submission handler for color_scheme_form().
EditorFileUsageTest::testEditorEntityHooks in core/modules/editor/tests/src/Kernel/EditorFileUsageTest.php
Tests the configurable text editor manager.
ExtensionMimeTypeGuesser::guess in core/lib/Drupal/Core/File/MimeType/ExtensionMimeTypeGuesser.php
Guesses the mime type of the file with the given path.
File::preCreate in core/modules/file/src/Entity/File.php
Changes the values of an entity before it is created.

... See full list


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


function drupal_basename($uri, $suffix = NULL) {
  return \Drupal::service('file_system')->basename($uri, $suffix);