You are here

public function PathFileController::file in Path File 8

1 string reference to 'PathFileController::file'
path_file.routing.yml in ./path_file.routing.yml
path_file.routing.yml

File

src/Controller/PathFileController.php, line 38

Class

PathFileController
An example controller.

Namespace

Drupal\path_file\Controller

Code

public function file(PathFileEntityInterface $path_file_entity) {
  $fid = $path_file_entity
    ->getFid();
  $file = File::load($fid);
  $uri = $file
    ->getFileUri();
  $server_path = $this->fileSystem
    ->realpath($uri);
  return new BinaryFileResponse($server_path);
}