file_check_path

Versions
4.6 – 6
file_check_path(&$path)

Checks path to see if it is a directory, or a dir/file.

Parameters

$path A string containing a file path. This will be set to the directory's path.

Return value

If the directory is not in a Drupal writable directory, FALSE is returned. Otherwise, the base name of the path is returned.

Related topics

▾ 1 function calls file_check_path()

file_copy in includes/file.inc
Copies a file to a new location. This is a powerful function that in many ways performs like an advanced version of copy().

Code

includes/file.inc, line 138

<?php
function file_check_path(&$path) {
  // Check if path is a directory.
  if (file_check_directory($path)) {
    return '';
  }

  // Check if path is a possible dir/file.
  $filename = basename($path);
  $path = dirname($path);
  if (file_check_directory($path)) {
    return $filename;
  }

  return FALSE;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.