View comments | RSS feed

GetTempFile

Description

Creates a temporary file in a directory whose name starts with (at most) the first three characters of prefix.

Returns

Name of a temporary file, as a string.

Category

System functions

Function syntax

GetTempFile(dir, prefix)

See also

GetTempDirectory

Parameters

Parameter Description

dir

Directory name

prefix

Prefix of a temporary file to create in the dir directory

Example

<h3>GetTempFile Example</h3>
<p>The temporary directory for this ColdFusion Server is
<cfoutput>#GetTempDirectory()#</cfoutput>. <p>We have created a temporary file called: <cfoutput>#GetTempFile(GetTempDirectory(),"testFile")#</cfoutput>

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | KnowledgeBase | Bug Reporting

Version 7

Comments


No screen name said on Sep 13, 2006 at 4:26 PM :
What is the purpose of this function. It is named "GetTempFile" when it creates a temporary file. What I am needing is a way to get the randomly named temporary filename from Coldfusions temporary upload directory so that I can link it up with the file I'm uploading.
halL said on Sep 14, 2006 at 7:02 AM :
The GetTempFile function creates a file with a name that consist of the specified prefix, a random number, and a .tmp suffix.
The file name is guaranteed to be unique in the directory.
The function is intended for generating temporary files that you can then write to.
It does not, however, ensure that the file is temporary. Your application must delete the file, if necessary.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/7/htmldocs/00000498.htm