currently trying to serve a static PDF file that is not within the web directory ($reasons).
I applied
$filepath = $this->getTargetFile($level, $name);
$response = new BinaryFileResponse($filepath);
$response->headers->set('Content-Type', 'application/pdf');
$response->setContentDisposition(
ResponseHeaderBag::DISPOSITION_INLINE,
$filename
);
return $response;
and Profiler shows that there is a Response with correct headers, but there is no document view and no download prompt whatsoever. Is there something I am missing?
/** Get target file */
public function getTargetFile($level, $name)
{
return $this->kernel->locateResource($staticPath . $level . '/' . $name);
}