HELP! tempnam(); function confusion
| From: | C. Marcera | Date: | Wed, 05 Jul 2000 15:11:01 +0000 |
| Subject: | HELP! tempnam(); function confusion | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-4973@lists.php.net to get a copy of this message | ||
### Why does this code:
$tmpfname = tempnam( "/tmp", "PErq" );
echo "file made '$tmpfname'<BR>";
echo "$tmpfname<BR>";
$tempfile = fopen( "$tmpfname", "w" );
echo "file open '$tempfile'<BR>";
$num = count( $query_results );
for( $i=0; $i<$num; $i++ ) {
fwrite( "$tempfile",
"\t<LI<STRONG>$query_results[$i]</STRONG><LI>\r" );
echo "file written to '$tempfile'<BR>";
}
fclose( "$tempfile" );
echo "file closed '$tempfile'<BR>";
### produce this:
file made '/tmp/PErq000730'
/tmp/PErq000730
file open '16'
file written to '16'
file closed '16'
Where is the 16 coming from? when I place a "/" or "/tmp" in the fopen()
function then it will display the '/tmp/PErq000730', but the path is wrong
then (i.e. Warning: fopen("/tmp//tmp/PErq000732","w") - No such file or
directory)
Is there another way to return the filename with tempnam()? Any help would
be great... thanks in advance!
--
C. Marcera
==========
Press Enterprise, Inc.
Computer & Network Services