note 109387 modified in function.tmpfile by danbrown
| From: | danbrown@php.net | Date: | Mon, 16 Jul 2012 15:34:44 +0000 |
| Subject: | note 109387 modified in function.tmpfile by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189184@lists.php.net to get a copy of this message | ||
If you want to specify the extension name of tmp
file: <?php $tmp=array_search('uri',
@array_flip(stream_get_meta_data($GLOBALS[mt_rand()]=tmpfile()))); rename($tmp,
$tmp.='.png'); register_shutdown_function(create_function('',
"unlink('{$tmp}');")); ?>
--was--
If you want to specify the extension name of tmp file:
<?
$tmp=array_search('uri',
@array_flip(stream_get_meta_data($GLOBALS[mt_rand()]=tmpfile())));
rename($tmp, $tmp.='.png');
register_shutdown_function(create_function('', "unlink('{$tmp}');"));
?>
http://php.net/manual/en/function.tmpfile.php