File Test
2003-02-17 00:23:19
Category: php:files
Description: Get information on a file.
Author: detour
Viewed: 2745
Rating: (4 votes)


<?php
  // filetest.php by detour@metalshell.com
  //
  // Get information on a file.
  //
  // http://www.metalshell.com/
  //
 
  $filename = "outf";
 
  if(is_dir($filename))
    echo("$filename is a directory.<br>");
  else
    echo("$filename is not a directory.<br>");
 
  if(is_file($filename))
    echo("$filename is a file.<br>");
  else
    echo("$filename is not a file<br>");
 
  if(is_executable($filename))
    echo("$filename is executable.<br>");
  else
    echo("$filename is not executable.<br>");
 
  if(is_link($filename))
    echo("$filename is a link.<br>");
  else
    echo("$filename is not a link.<br>");
 
  if(is_readable($filename))
    echo("$filename is readable.<br>");
  else
    echo("$filename is not readable.<br>");
 
  if(is_writable($filename))
    echo("$filename is writeable.<br>");
  else
    echo("$filename is not writeable.<br>");
 
?>