
270
DEVELOPING
COLDFUSION 9 APPLICATIONS
Developing CFML Applications
Las
t
upda
te
d 8/5/2010
File operations
The following file operations are supported for in-memory files:
•
Directory-specific operations: create, delete, list, and rename.
•
File-specific operations: copy, create, write, append, delete, rename, create attributes, modes move, and read.
Example
The following code illustrates the file and directory operations:
<cfdirectory action = "create" directory = "ram://src" >
<cfdirectory action = "create" directory = "ram://des" >
<cfdirectory action = "rename" directory = "ram:///CurrentDir" newDirectory = "NewDir">
<cfdirectory action="list" directory="ram://" name="listDir" recurse="yes" >
<cfdump var="#listDir#">
<cffile action="write" file = "ram://src/test.txt" output = "Release Description">
<cffile action="copy" source="ram://src/test.txt" destination="ram://des/final.txt" >
<cffile action="rename" source = "ram:///src/message.txt" destination = "ram:///des/test.txt">
<cffile action ="move" source = "ram:///des/test.txt" destination = "c:\des\move.txt">
Document and image actions
All image and document actions can use in-memory image files as shown in the following examples:
<cfimage action="captcha" fontSize="15" width="180" height="50" text="readMe"
destination="ram:///readMe.jpg"
difficulty="medium">
<cfimage source="ram://aiden02.png" action="convert"
destination="#ExpandPath("./")#/blue1.JPG" overwrite="yes">
<cfdocument format="pdf" filename="ram://Sample.pdf" overwrite="yes">Sample Text</cfdocument>
Custom tags
In-memory CFM pages and CFCs can call custom tags but the custom tags must be present in disk. In-memory custom
tags are not supported.
Using in-memory files in tags
The following tags are supported for in-memory files:
•
cfcontent
•
cfdocument
•
cfdump
•
cfexchange
•
cfexecute
•
cffeed
•
cfhttp
•
cfftp
•
cfimage
•
cfloop