Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP tempnam() Function

PHP tempnam() Function


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual


Definition and Usage

The tempnam() function creates a temporary file with a unique name in a specified directory.

Returns the new temporary file name, or FALSE on failure.

Syntax

tempnam(dir,prefix)

Parameters Description
dir Required. Specifies the directory in which to create the temporary file.
prefix Required. Specifies the beginning of the file name.

Tips and Notes

**Note:** If the specified directory does not exist, tempnam() will generate a file in the system's temporary directory.

**Tip:** See tmpfile().


Example

The code above will output:

C:inetpubtestwebTMP1.tmp


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual