Nov 19th, 2012
<?php $filename = $_SERVER['DOCUMENT_ROOT'] . "/sites/default/settings.php"; $file = file_get_contents($filename); if (is_writable($filename)) { echo "The file is writable<br />\n"; } else { echo "The file is not writable<br />\n"; } print "<pre>"; print_r($file); print "</pre>"; /** * list all directories/folders in a specified location **/ //path to directory to scan $directory = $_SERVER['DOCUMENT_ROOT'] . "/directory/"; //get all files in specified directory $files = glob($directory . "*"); //print each folder name foreach($files as $file) { //check to see if the file is a folder/directory if(is_dir($file)) { echo $file; } } /** * list all image files in a specified location **/ //path to directory to scan $directory = $_SERVER['DOCUMENT_ROOT'] . "/sites/all/modules/custom/otmobile_meter_registration/includes/submissions/"; //get all image files with a .jpg extension. // $files = glob($directory . "*.jpg"); //get all files regardless of extension $files = glob($directory . "*"); //print each file name foreach($files as $files) { echo $image; } ?>