PHP tempnam() Function
Definition
The tempnam() function creates a temporary file with a unique filename in the specified directory.
Syntax
PHP tempnam() Function has the following syntax.
tempnam(dir,prefix)
Parameter
Parameter | Is Required | Description |
---|---|---|
dir | Required. | Directory of where to create the temp file |
prefix | Required. | Start of the filename |
Return
This function returns the new temporary filename, or FALSE on failure.
Note
If the specified directory does not exist, tempnam() may generate a file in the system's temporary directory.
Example
<?php
echo tempnam("C:\test\testweb","TMP0");
?>