user3287495
user3287495

Reputation: 67

CakePHP Sending Files

I am trying to render images/pdfs that exist outside of my webroot. So this is what I'm doing in my controller to Send the File - as described here. But I'm getting a Fatal Error. Any ideas why and how to fix this? I'm running CakePHP 2.4.5.

$this->autoRender = false;
$path = '/path/to/valid/file.pdf';
$this->response->file($path);
return $this->response;

Fatal error: Call to undefined method Folder::slashTerm()

Stack trace:

  1. {main}() /Path/To/My/htdocs/mysite/app/webroot/index.php:0
  2. Dispatcher->dispatch() /Path/To/My/htdocs/mysite/app/webroot/index.php:96
  3. Dispatcher->_invoke() /Path/To/My/htdocs/mysite/lib/Cake/Routing/Dispatcher.php:160
  4. Controller->invokeAction() /Path/To/My/htdocs/mysite/lib/Cake/Routing/Dispatcher.php:185
  5. ReflectionMethod->invokeArgs() /Path/To/My/htdocs/mysite/lib/Cake/Controller/Controller.php:490
  6. PagesController->load_media() /Path/To/My/htdocs/mysite/lib/Cake/Controller/Controller.php:490
  7. CakeResponse->file() /Path/To/My/htdocs/mysite/app/Controller/PagesController.php:227
  8. File->__construct() /Path/To/My/htdocs/mysite/lib/Cake/Network/CakeResponse.php:1265
  9. File->pwd() /Path/To/My/htdocs/mysite/lib/Cake/Utility/File.php:91

Upvotes: 2

Views: 709

Answers (1)

user3287495
user3287495

Reputation: 67

Problem solved. I had a Plugin that had a class Folder that was taking this over.

Upvotes: 1

Related Questions