...

View Full Version : Checking existence of file



Exodious
12-14-2003, 09:40 PM
Hiya, what is the fastest method of checking for the existence of a file?

At the moment, I'm using fopen but if file exists, I'm adding overhead, is there a function in php which will return true or false faster than fopen?

Exodious
12-14-2003, 10:01 PM
scrap tbat, file_exists

Spookster
12-14-2003, 10:02 PM
using the file_exists() function maybe?

http://us4.php.net/file_exists

SDP2006
12-15-2003, 01:30 AM
<?php
$file = "somefileonyourserver.php";
if(file_exists($file)){
echo "$file exists!";
}
else
{
echo "$file does not exist!";
}
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum