CakePHP 1.3 still offers support for PHP4, yet most CakePHP applications are built exclusively for PHP5. Therefore, it is only expected that our applications use language features only available in PHP5, such as exceptions.
However, there is no built-in support in CakePHP to handle exceptions. This recipe shows us how to create a base exception class that can be used throughout our application, and how to properly recover the application workflow after an exception is thrown.
We need a basic application skeleton to work with. Follow the entire recipe Detecting file types with MagicDb.
app/controllers/uploads_controller.phpfile and change the
download()methods, so ...