note 77547 added to function.tempnam
| From: | dmhouse at gmail dot com | Date: | Mon, 03 Sep 2007 10:51:56 +0000 |
| Subject: | note 77547 added to function.tempnam | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130120@lists.php.net to get a copy of this message | ||
Guillaume Paramelle's comments below are worth underlining: tempnam() will not accept a
relative path for its first directory. If you pass it one, it will (on Windows XP at least) create
the temporary file in the system temp directory.
The easiest way to convert a relative path to an absolute path is to prepend getcwd():
<?php
$file = tempnam('files/temp', 'tmp'); // Wrong!
$file = tempnam(getcwd() . 'files/tmp', 'tmp') // Right.
?>
----
Server IP: 194.246.101.61
Probable Submitter: 212.155.191.21
----
Manual Page -- http://www.php.net/manual/en/function.tempnam.php
Edit -- https://master.php.net/note/edit/77547
Del: integrated -- https://master.php.net/note/delete/77547/integrated
Del: useless -- https://master.php.net/note/delete/77547/useless
Del: bad code -- https://master.php.net/note/delete/77547/bad+code
Del: spam -- https://master.php.net/note/delete/77547/spam
Del: non-english -- https://master.php.net/note/delete/77547/non-english
Del: in docs -- https://master.php.net/note/delete/77547/in+docs
Del: other reasons-- https://master.php.net/note/delete/77547
Reject -- https://master.php.net/note/reject/77547
Search -- https://master.php.net/manage/user-notes.php