Using the File-System Logic Functions : is_link « File Directory « PHP






Using the File-System Logic Functions

 
<?php
     $testfile = "data.txt";
     if(!file_exists($testfile)) {
          echo "Error -- $testfile doesn't exist!<BR>";
          exit;
     }
     echo "What we know about the file $testfile<BR>";
     if(is_dir($testfile)) echo "It is a directory.<BR>";
     if(is_file($testfile)) echo "It is an actual file (not symbolic link)<BR>";
     if(is_link($testfile)) echo "It is a symbolic link to a real file<BR>";
     if(is_uploaded_file($testfile)) echo "It is an uploaded file<BR>";
     if(is_readable($testfile)) echo "The file is readable by PHP<BR>";
     if(is_writeable($testfile)) echo "The file is writeable by PHP<BR>";
     if(is_executable($testfile)) echo "The file is executable by PHP<BR>";
?>
  
  








Related examples in the same category