note 35762 deleted from function.tempnam by vincent
| From: | vincent@php.net | Date: | Sat, 13 Sep 2003 15:42:31 +0000 |
| Subject: | note 35762 deleted from function.tempnam by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56452@lists.php.net to get a copy of this message | ||
Note Submitter: tomelders at hotmail
----
NEWBIE QUESTION!!
I wrote this:
<?php
$file = tempnam("http://localhost/website/txtFiles",
"monkey.txt") or die ("could not create file");
$handle = fopen("$file", 'w') or die ("could not open file");
fwrite($handle, "WRITE SOMETHING HERE") or die ("could not write to file");
fclose($handle) or die ("could not close file");
?>
For some reason the file created isn't turning up in the directory I specified but is instead
turning up in /var/tmp with lots of additional letters stuck on the end of the .txt extension (ie:
/var/tmp/monkey.txtIkXQGB). I opend the file and there was nothing in it either.
I have a sneaking suspicion that I'm using the wrong function to achive my goal (does tempnam()
only create temporary files that dissappear when the script is finished?) but would love someone to
give me a clue as to where I'm going wrong.
Your friend and mine;
Slowpoke