file_exists on Windows problem
| From: | Chris Williams | Date: | Thu, 20 Nov 2003 03:50:13 +0000 |
| Subject: | file_exists on Windows problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-170364@lists.php.net to get a copy of this message | ||
I'm again trying to understand differences in Apache and Windows installs of
PHP when I try to upload a file to the server. It seems on Windows, I can't
get the file I'm uploading.
To try to understand this I created a very simple html form that uploads a
text file to the server's TEMP directory using:
<form action="Upload.php" method="post"
enctype="multipart/form-data">
The script Upload.php contains the following:
$filename = $_FILES['datafile']['tmp_name'];
echo "filename: " . $filename ."<br>";
if (file_exists("$filename")) {
print "The file $filename exists";
} else {
print "The file $filename does not exist";
}
echo "<br><br>";
@readfile($filename);
echo "<br><br>";
Now the file seems to have been copied to the server because filename prints
out the path to the file and @readfile($filename) displays the content of
the file. However, file_exists tells me the file does not exist. I also
tired getting file size but again I got an error no file exists.
Of course this all works on Apache. What is up with this?
Thanks
Chris