- Forums
- PHP
- How To Check If A File Exists Using Php
This Page Contains information about How To Check If A File Exists Using Php By Webune Support in category PHP with 0 Replies. [2044], Last Updated: Mon Jun 24, 2024
Webune Support
Thu Oct 08, 2009
0 Comments
378 Visits
hello, welcome to webune forums. one of the good things about php is that is very flexible and user friendly programming lanaguage.
with php you can make dynamic web pages.
on of many functions is the file_exists() which checks whether or not a particular files exists in a directory or not.
for example, lets say i want to confirm whether or not a file called webune.php does exist in the /home/wwww/web/ directory, this is how i can do it with php
<?php
$FileLocation = '/home/wwww/web/webune.php';
if (file_exists($FileLocation )) {
echo "The file $FileLocation exists";
} else {
echo "The file $FileLocation does NOT exist";
}
?>
thats it, pretty simple right?