Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_tempnam [ WordPress Function ]

wp_tempnam ( $filename = '', $dir = '' )
Parameters:
  • (string) $filename (optional) Filename to base the Unique file off
  • (string) $dir (optional) Directory to store the file in
Returns:
  • (string) a writable filename
Defined at:



Returns a filename of a Temporary unique file.

Please note that the calling function must unlink() this itself.

The filename is based off the passed parameter or defaults to the current unix timestamp, while the directory can either be passed as well, or by leaving it blank, default to a writable temporary directory.

Source


<?php
function wp_tempnam($filename ''$dir '') {
    if ( empty(
$dir) )
        
$dir get_temp_dir();
    
$filename basename($filename);
    if ( empty(
$filename) )
        
$filename time();

    
$filename preg_replace('|\..*$|''.tmp'$filename);
    
$filename $dir wp_unique_filename($dir$filename);
    
touch($filename);
    return 
$filename;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics