Skip to content

Commit cbd91b4

Browse files
committed
feature #5345 Adding information about empty files sent using BinaryFileResponse. (kherge)
This PR was submitted for the 2.7 branch but it was merged into the 2.3 branch instead (closes #5345). Discussion ---------- Adding information about empty files sent using BinaryFileResponse. Updating documentation to account for weird scenario described in #5268. Commits ------- aa2ac55 Adding information about empty files sent using BinaryFileResponse.
2 parents 8467240 + aa2ac55 commit cbd91b4

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)