Adobe ColdFusion 8

Setting file and directory attributes

In Windows, you specify file attributes using attributes attribute of the cffile tag. In UNIX, you specify file or directory permissions using the mode attribute of the cffile or cfdirectory tag.

Windows

In Windows, you can set the following file attributes:

  • Hidden
  • Normal
  • ReadOnly

To specify several attributes in CFML, use a comma-separated list for the attributes attribute; for example, attributes="ReadOnly,Hidden". If you do not use the attributes attribute, the file's existing attributes are maintained. If you specify any other attributes in addition to Normal, the additional attribute overrides the Normal setting.

UNIX

In UNIX, you can individually set permissions on files and directories for each of three types of users--owner, group, and other. You use a number for each user type. This number is the sum of the numbers for the individual permissions allowed. Values for the mode attribute correspond to octal values for the UNIX chmod command:

  • 4 = read
  • 2 = write
  • 1 = execute

You enter permissions values in the mode attribute for each type of user: owner, group, and other in that order. For example, use the following code to assign read permissions for everyone:

mode=444

To give a file or directory owner read/write/execute permissions and read only permissions for everyone else:

mode=744