How To Check If A File Exists Using Php

RegisterLogin
How To Check If A File Exists Using Php
Post Description: How To Check If A File Exists Using Php
Tags: How, To, Check, If, A, File, Exists, Using, Php
This Post Was Posted On Oct 08, 2009 By Webune Support #2504
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?

Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
©2011 Webune Forums - Tue Dec 20, 2011 7:59 pm
Powered by: Webune Forums V3