PHP tempnam() Function

Create a temporary file with a unique name in the specified directory

Definition and Usage

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

Note: If the specified directory does not exist, tempnam() may generate a file in the system's temporary directory.
Tip: See also the tmpfile() function.

Syntax

tempnam(dir, prefix)

Parameter Values

Parameter Description
dir Required. Specifies the directory of where to create the temp file
prefix Required. Specifies the start of the filename

Technical Details

Return Value: The new temporary filename, FALSE on failure
PHP Version: 4.0+
PHP Changelog:  

❮ PHP Filesystem Reference