public function PathFileController::file in Path File 8
1 string reference to 'PathFileController::file'
File
- src/
Controller/ PathFileController.php, line 38
Class
- PathFileController
- An example controller.
Namespace
Drupal\path_file\ControllerCode
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);
}