note 35762 added to function.tempnam

From: Date: Sat, 13 Sep 2003 15:40:38 +0000
Subject: note 35762 added to function.tempnam
Groups: php.notes 
Request: Send a blank email to php-notes+get-56451@lists.php.net to get a copy of this message
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 ---- Manual Page -- http://www.php.net/manual/en/function.tempnam.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35762 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35762&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35762&report=yes

« previous php.notes (#56451) next »