tempnam
(PHP 4, PHP 5)
tempnam — Create file with unique file name
Description
string tempnam
( string $dir
, string $prefix
)
Parameters
-
dir
-
The directory where the temporary filename will be created.
-
prefix
-
The prefix of the generated temporary filename.
Return Values
Returns the new temporary filename, or FALSE on
failure.
Examples
Example #1 tempnam() example
<?php
$tmpfname = tempnam("/tmp", "FOO");
$handle = fopen($tmpfname, "w");
fwrite($handle, "writing to tempfile");
fclose($handle);
unlink($tmpfname);
?>
Notes
Note:
If PHP cannot create a file in the specified dir
parameter, it falls back on the system default.