orascr wrote:I'm new to php world so would appreciate any help.
I have to create a URL or a text message based upon of file exists in a certain directory.
For example,
if
<test.touch> exists in </home/user> dir
then
message A
else
message B
you can use http://php.net/is_file
( there is also one that tests for directory http://php.net/is_dir )
<?php
// see if my logo is in folder 'images'
$file = 'images/my_logo.gif';
if ( is_file( $file ) ) {
echo 'yes, logo is there!';
} else {
echo 'sorry, not found!';
}
?>
there is another function: file_exists( 'name' )
http://php.net/file_exists
returns TRUE if 'name' is file or directory
.