Create a temporary file with a unique name in the specified directory.
<?php echo tempnam(“C:\inetpub\testweb”,“TMP0”); ?> |
The result of the code above might be:
C:\inetpub\testweb\TMP1.tmp |
The tempnam() function creates a temporary file with a unique name in the given directory.
Note: If the specified directory does not exist, tempnam() may create the file in the system’s temporary directory.
Tip: Also consider using the tmpfile() function.
tempnam(dir, prefix) |
Parameter |
Description |
dir |
Required. Specifies the directory in which to create the temporary file. |
prefix |
Required. Specifies the prefix for the filename. |
Return Value: |
Returns the new temporary filename on success; FALSE on failure. |
PHP Version: |
4.0+ |
PHP Changelog: |
Returns the new temporary filename on success; FALSE on failure. |