How To The Write `<cffile action = “copy”>` Function In ColdFusion?
Description:-
Copies a file from one directory to another on the server.
<cffile
action = "copy"
destination = "full pathname"
source = "full pathname"
attributes = "file attributes list"
mode = "mode"
>
Attributes:-
action
:- This is a required attribute, the type of file manipulation the tag performs.
destination:-
This is a required attribute, the Pathname of a directory or file on the web server where the file is copied. If you specify a filename without a directory path, ColdFusion copies it relative to the source directory.
source:-
This is a required attribute, the Pathname of the file to be copied. If it is not an absolute path (starting with a drive letter and a colon, or a forward or backward slash), it is relative to the ColdFusion temporary directory, which is returned by the GetTempDirectory function.
attributes
:- This is a non-required attribute, A comma-delimited list of attributes to set on the file that applies to Windows. the values are:-
readOnly
hidden
normal
mode:-
This is a non-required attribute and applies only to UNIX and Linux. Permissions. Octal values of UNIX chmod command. Assigned to owner, group, and other, respectively.
644:-
assigns read/write permission to the owner; read permission to group and others.
777:-
assigns read/write/execute permission to all.
Example:-
This example copies the testNote.txt
file to the d:\files\documents\textNote\
directory.
<cffile
action = "copy"
source = "d:\files\documents\testNote.txt"
destination = "d:\files\documents\textNote\"
>