How to download file upon submitting a form?
You need to set the filename with setContentDisposition, as the constructor only takes the file, but doesn't set the name itself:

$response-&gt;setContentDisposition(
    ResponseHeaderBag::DISPOSITION_ATTACHMENT,
    'my_doc.docx'
);


Don't forget to add use Symfony\Component\HttpFoundation\ResponseHeaderBag; at the top of your file.

There is quite a bit more you can do with BinaryFileResponse as well, so check out some of the methods.