File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -518,6 +518,20 @@ It is possible to delete the file after the request is sent with the
518518:method: `Symfony\\ Component\\ HttpFoundation\\ BinaryFileResponse::deleteFileAfterSend ` method.
519519Please note that this will not work when the ``X-Sendfile `` header is set.
520520
521+ .. versionadded :: 3.3
522+ The ``Stream `` class has been introduced in Symfony 3.3.
523+
524+ If the size of the served file is unknown (e.g. because it's being generated on the fly,
525+ or because a PHP stream filter is registered on it, etc.), you can pass a ``Stream ``
526+ instance to ``BinaryFileResponse ``. This will disable ``Range `` and ``Content-Length ``
527+ handling, switching to chunked encoding instead::
528+
529+ use Symfony\Component\HttpFoundation\BinaryFileResponse;
530+ use Symfony\Component\HttpFoundation\File\Stream;
531+
532+ $stream = new Stream('path/to/stream');
533+ $response = new BinaryFileResponse($stream);
534+
521535.. note ::
522536
523537 If you *just * created the file during this same request, the file *may * be sent
You can’t perform that action at this time.
0 commit comments