MediaView (class)
Class MediaView
Media View provides a custom view implementation for sending files to visitors. Its great for making the response of a controller action be a file that is saved somewhere on the filesystem.
An example use comes from the CakePHP internals. MediaView is used to serve plugin and theme assets, as they are not normally accessible from an application's webroot. Unlike other views, MediaView uses several viewVars that have special meaning:
-
id
The filename on the server's filesystem, including extension. -
name
The filename that will be sent to the user, specified without the extension. -
download
Set to true to set aContent-Disposition
header. This is ideal for file downloads. -
path
The absolute path, including the trailing / on the server's filesystem toid
. -
mimeType
The mime type of the file if Cak