Skip to content

Commit aa2ac55

Browse files
khergeweaverryan
authored andcommitted
Adding information about empty files sent using BinaryFileResponse.
1 parent 8467240 commit aa2ac55

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

components/http_foundation/introduction.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,20 @@ You can still set the ``Content-Type`` of the sent file, or change its ``Content
482482
'filename.txt'
483483
);
484484

485+
.. versionadded:: 2.6
486+
The ``deleteFileAfterSend()`` method was introduced in Symfony 2.6.
487+
488+
It is possible to delete the file after the request is sent with the
489+
:method:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse::deleteFileAfterSend` method.
490+
Please note that this will not work when the ``X-Sendfile`` header is set.
491+
492+
.. note::
493+
494+
If you *just* created the file during this same request, the file *may* be sent
495+
without any content. This may be due to cached file stats that return zero for
496+
the size of the file. To fix this issue, call ``clearstatcache(false, $file)``
497+
with the path to the binary file.
498+
485499
.. _component-http-foundation-json-response:
486500

487501
Creating a JSON Response

0 commit comments

Comments
 (0)