Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita1aaae3

Browse files
[HttpFoundation] Add doc for File\Stream
1 parentfefc2f2 commita1aaae3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎components/http_foundation.rst‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff 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.
519519
Please note that this will not work when the ``X-Sendfile`` header is set.
520520

521+
..versionaded::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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp