Lucee Tag Reference
Tag <CFFILE>
Handles all interactions with files. The attributes you use with cffile depend on the value of the action attribute.
For example, if the action = "write", use the attributes associated with writing a text file.
Body
This tag may have a body.
Example
<cffile [accept="string"] action="string" [addnewline="boolean"] [attributes="string"] [charset="string"] [createpath="boolean"] [destination="string"] [file="string"] [filefield="string"] [fixnewline="boolean"] [mode="string"] [nameconflict="string"] [output="any"] [result="string"] [serverpassword="string"] [source="string"] [storeacl="object"] [strict="boolean"] [variable="string"]> [</cffile>]
This tag is also supported within cfscript
<cfscript> file [accept="string"] action="string" [addnewline="boolean"] [attributes="string"] [charset="string"] [createpath="boolean"] [destination="string"] [file="string"] [filefield="string"] [fixnewline="boolean"] [mode="string"] [nameconflict="string"] [output="any"] [result="string"] [serverpassword="string"] [source="string"] [storeacl="object"] [strict="boolean"] [variable="string"] { } </cfscript>
Attributes
The attributes for this tag are fixed. Except for the following attributes no other attributes are allowed.
Name | Type | Required | Description |
---|---|---|---|
accept | string | No | list of supported extensions or/and mimetypes. |
action | string | Yes | Type of file manipulation that the tag performs. |
addnewline | boolean | No | Yes: appends newline character to text written to file |
attributes | string | No | One attribute (Windows) or a comma-delimited list of attributes (other platforms) to set on the file. If omitted, the file's attributes are maintained. |
charset | string | No | Character set name for the file contents. |
createpath | boolean | No | for action "append", "touch" and "write": if set to false (default), expects all parent directories to exist, true will generate necessary directories |
destination | string | No | Absolute pathname of directory or file on web server. |
file | string | No | Absolute pathname of file on web server. |
filefield | string | No | Name of form field used to select the file. |
fixnewline | boolean | No | - true: changes embedded line-ending characters in string variables to operating-system specific line endings - false: (default) do not change embedded line-ending characters in string variables. |
mode | string | No | Applies only to Solaris and HP-UX. Permissions. Octal values of UNIX chmod command. Assigned to owner, group, and other, respectively. |
nameconflict | string | No | Action to take if filename is the same as that of a file in the directory. |
output | any | No | Content of the file to be created. |
result | string | No | Name of the result value (default:cffile) |
serverpassword | string | No | allow you to access filesystem, also when access is denied for your context |
source | string | No | Absolute pathname of file on web server. On Windows, use backward slashes; on UNIX, use forward slashes. |
storeacl | any | No | An array of struct where each struct represents a permission or grant. Example: [{email="[email protected]", permission="full_control"}, {group="all", permission="read"}] |
strict | boolean | No | for action "upload" and "uploadAll": if set to true (default), only mimetypes are supported. |
variable | string | No | Name of variable to contain contents of text file. |