Whatever message this page gives is out now! Go check it out!

GetTempFile

Last update:
May 18, 2026

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

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> 

<p>We have created a temporary file called: 

<cfoutput>#GetTempFile(GetTempDirectory(),"testFile")#</cfoutput></p>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page