Home > PHP > Function > Filesystem > tempnam()

tempnam()

tempnam - Create file with unique file name

Syntax

string tempnam (string $dir, string $prefix)

Arguments

  • dir - The directory where the temporary filename will be created.
  • prefix - The prefix of the generated temporary filename. Note: Windows uses only the first three characters of prefix.

Description

Creates a file with a unique filename, with access permission set to 0600, in the specified directory. If the directory does not exist, tempnam() may generate a file in the system's temporary directory, and return the name of that.

Version

PHP 4, 5

Return value

Returns the new temporary filename, or FALSE on failure.