The path to file variable is the absolute path of the file that you wish to have the user force download it.
The 3 headers are important, otherwise they won’t work. The basename function is also important in case you might pass a variable that contains the absolute path of the filename and we do not want other users to see the file structure of your server.
The basename function removes all directory paths and returns the name of the file itself.
By default, Recess PHPs’s JsonView class responds with the properties of your controller. So even if you create a custom route that outputs only an array, a default row of the controller’s model will also be included with null values.
You can override this using the OKResponse class. You can do it like this.