Mega Code Archive

 
Categories / Php / File Directory
 

Checking the Mode of a File

<?php   $myfile = "./test.txt";   if (is_readable ($myfile)) {     echo "The file can be read!", "\n";   } else {     echo "The file cannot be read.", "/n";   }      if (is_writable ($myfile)) {     echo "The file can be used for writing!", "/n";   } else {     echo "The file cannot be used for writing.", "/n";   }   if (is_executable ($myfile)) {     echo "The file is executable!", "\n";   } else {     echo "The file is not executable.", "\n";   } ?>