 <p>The most comfortable solution is</p> <pre><code>use Symfony\Component\HttpFoundation\BinaryFileResponse; use Symfony\Component\HttpFoundation\ResponseHeaderBag; $response = new BinaryFileResponse($file); $response-&gt;setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT); return $response; </code></pre>