Return to v2.5.0 docs


Controller Miscellaneous Functions any controller

Sends a file to the user (from the files folder or a path relative to it by default).

Name Type Required Default Description
file string Yes The file to send to the user.
name string No The file name to show in the browser download dialog box.
type string No The HTTP content type to deliver the file as.
disposition string No attachment Set to inline to have the browser handle the opening of the file (possibly inline in the browser) or set to attachment to force a download dialog box.
directory string No Directory outside of the web root where the file exists. Must be a full path.
deleteFile boolean No false Pass in true to delete the file on the server after sending it.
deliver boolean No true
// Send a PDF file to the user

// Send the same file but give the user a different name in the browser dialog window
sendFile(file="wheels_tutorial_20081028_J657D6HX.pdf", name="Tutorial.pdf");

// Send a file that is located outside of the web root

// Send a file that is located in ram://

Related Functions

Miscellaneous Functions