From aa2ac559bd1d8b7c8c814b0b9d4c62a2cac988de Mon Sep 17 00:00:00 2001 From: Kevin Herrera Date: Sun, 31 May 2015 21:30:25 -0700 Subject: [PATCH] Adding information about empty files sent using BinaryFileResponse. --- components/http_foundation/introduction.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index afdcb0f06ca..cb56ab2ca97 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -482,6 +482,20 @@ You can still set the ``Content-Type`` of the sent file, or change its ``Content 'filename.txt' ); +.. versionadded:: 2.6 + The ``deleteFileAfterSend()`` method was introduced in Symfony 2.6. + +It is possible to delete the file after the request is sent with the +:method:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse::deleteFileAfterSend` method. +Please note that this will not work when the ``X-Sendfile`` header is set. + +.. note:: + + If you *just* created the file during this same request, the file *may* be sent + without any content. This may be due to cached file stats that return zero for + the size of the file. To fix this issue, call ``clearstatcache(false, $file)`` + with the path to the binary file. + .. _component-http-foundation-json-response: Creating a JSON Response