Re: file_exists on Windows problem

From: Date: Thu, 20 Nov 2003 01:40:16 +0000
Subject: Re: file_exists on Windows problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-170373@lists.php.net to get a copy of this message
It may be an OS feature file_exists relies on... But you can use is_uploaded_file() function to check whether the file exists or not. Manu. "Chris Williams" <chris@escaperadius.com> wrote in message news:20031120004826.56215.qmail@pb1.pair.com... > 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

« previous php.general (#170373) next »