In Windows, you specify file attributes using the cffile
attributes
attribute. In UNIX, you specify file and directory permissions using the cffile
and cfdirectory
mode
attribute.
In Windows, you can set the following file attributes:
To specify several attributes, use a comma-separated list, such as attributes="ReadOnly,Archive"
. If you do not use attributes
, the file's existing attributes are maintained. If you specify any other attributes with Normal, the additional attribute overrides the Normal setting.
This example sets the archive bit for the uploaded file:
<cffile action="Copy"
source="c:\files\upload\keymemo.doc" destination="c:\files\backup\" attributes="Archive">
Note Make sure you include the trailing slash (\) when you specify the destination directory. Otherwise, ColdFusion treats the last element in the pathname as a filename. |
In UNIX, you can set permissions on files and directories for owner, group, and other. Values for the mode
attribute correspond to octal values for the UNIX chmod
command:
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