You are viewing documentation for v1.0.x. Change

sendFile()

Description

Sends a file to the user (from the files folder by default).

Function Syntax

sendFile(file [, name, type, disposition ])

Parameters

Parameter 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 or set to 'attachment' to force a download dialog box

Examples

<!--- Send a PDF file to the user --->
<cfset sendFile(file="wheels_tutorial_20081028_J657D6HX.pdf")>

<!--- Send the same file but give the user a different name in the browser dialog window --->
<cfset sendFile(file="wheels_tutorial_20081028_J657D6HX.pdf", name="Tutorial.pdf")>

<!--- Send a file that is located outside of the web root --->
<cfset sendFile(file="../../tutorials/wheels_tutorial_20081028_J657D6HX.pdf")>