From 9c89ebb3f4720329e79ce336c50f62b7cd90eda7 Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Tue, 23 Oct 2018 22:46:33 -0500 Subject: [PATCH] Update docs for downloads to reflect the need to return it. Fixes #1331 --- user_guide_src/source/outgoing/response.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/outgoing/response.rst b/user_guide_src/source/outgoing/response.rst index a81a58553d19..04e801168f1c 100644 --- a/user_guide_src/source/outgoing/response.rst +++ b/user_guide_src/source/outgoing/response.rst @@ -92,13 +92,16 @@ Example:: $data = 'Here is some text!'; $name = 'mytext.txt'; - $response->download($name, $data); + return $response->download($name, $data); If you want to download an existing file from your server you'll need to do the following:: // Contents of photo.jpg will be automatically read - $response->download('/path/to/photo.jpg', NULL); + return $response->download('/path/to/photo.jpg', NULL); + +.. note:: The response object MUST be returned for the download to be sent to the client. This allows the response + to be passed through all **after** filters before being sent to the client. HTTP Caching ============