query->get('file'); // Merge remaining path arguments into relative file path. $uri = $scheme . '://' . $target; if (file_stream_wrapper_valid_scheme($scheme) && file_exists($uri)) { // Let other modules provide headers and controls access to the file. $headers = $this->moduleHandler()->invokeAll('file_download', array($uri)); foreach ($headers as $result) { if ($result == -1) { throw new AccessDeniedHttpException(); } } if (count($headers)) { return new BinaryFileResponse($uri, 200, $headers); } throw new AccessDeniedHttpException(); } throw new NotFoundHttpException(); } }