File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -495,6 +495,13 @@ You can accomplish that by using :php:meth:`Cake\\Http\\Response::withFile()`::
495495 return $response;
496496 }
497497
498+ // Prior to 3.4.0
499+ $file = $this->Attachments->getFile($id);
500+ $this->response->file($file['path']);
501+ // Return the response to prevent controller from trying to render
502+ // a view.
503+ return $this->response;
504+
498505As shown in the above example, you must pass the file path to the method.
499506CakePHP will send a proper content type header if it's a known file type listed
500507in `Cake\\Http\\Reponse::$_mimeTypes `. You can add new types prior to calling
@@ -509,6 +516,12 @@ the browser by specifying the options::
509516 ['download' => true, 'name' => 'foo']
510517 );
511518
519+ // Prior to 3.4.0
520+ $this->response->file(
521+ $file['path'],
522+ ['download' => true, 'name' => 'foo']
523+ );
524+
512525The supported options are:
513526
514527name
You can’t perform that action at this time.
0 commit comments