1 file_example_session_streams.inc protected FileExampleSessionStreamWrapper::getLocalPath($uri = NULL)

Returns the local path.

Here we aren't doing anything but stashing the "file" in a key in the $_SESSION variable, so there's not much to do but to create a "path" which is really just a key in the $_SESSION variable. So something like 'session://one/two/three.txt' becomes $_SESSION['file_example']['one']['two']['three.txt'] and the actual path is "one/two/three.txt".

Parameters

string $uri: Optional URI, supplied when doing a move or rename.

File

modules/examples/file_example/file_example_session_streams.inc, line 202
Provides a demonstration session:// stream-wrapper.

Class

FileExampleSessionStreamWrapper
Example stream wrapper class to handle session:// streams.

Code

protected function getLocalPath($uri = NULL) {
  if (!isset($uri)) {
    $uri = $this->uri;
  }

  $path = str_replace('session://', '', $uri);
  $path = trim($path, '/');

  return $path;
}