code: protected function getPath($pathname) {
          $arr = explode('/', $pathname);
          $partialPathArray = array_slice($arr, 0, count($arr)-1);
          $path = implode('/', $partialPathArray);
  
          // If path isn't blank, then add ending slash to it.
          if ($path != '')
              $path = $path . '/';
  
          return $path;
      }
docs: Get the 'folder/folder' out of 'folder/folder/fileName.php