Its working.
Code:
<?php
$directory = '/home/wapfuns/public_html/';
$wtlf = 'index'; //what to look for
$flag = false;
$ext = array( '.jpg' , '.gif' , '.png', '.php', '.html' );
for( $i = 0; count( $ext ) > $i; $i++ )
{
if( file_exists( $directory . $wtlf . $ext[$i] ) )
{
$flag = true;
$name .= $wtlf . $ext[$i];
}
}
if($flag == true)
{
echo 'found file!<br/>';
echo $name;
}
else
{
echo "file not found.";
}
?> result is
found file!
index.phpindex.html
Use
Code:
<?
echo __FILE__;
?>
to get file's path.
Bookmarks