jimbowvu80s Posted December 30, 2010 Share Posted December 30, 2010 Is it possbile to use PHP to list directories outside of the root of the web server - for example c:\images or d:\images? I can use this script to list the files from the root down, but when I change the path to look at something outside the web server directory I get zero results back. Thank you. <?php filesInDir('d:\policy'); function filesInDir($tdir) { echo ("<p><h1>List of files in ($tdir):</h1></p><hr><br />"); $dirs = scandir($tdir); foreach($dirs as $file) { if (($file == '.')||($file == '..')) { } elseif (is_dir($tdir.'/'.$file)) { filesInDir($tdir.'/'.$file); } else { echo $tdir.'/'.$file.' --- '.date("F d Y H:i:s", filemtime('$file'))."<br>"; } } } ?> Link to comment https://forums.phpfreaks.com/topic/223022-question-on-directory-listing/ Share on other sites More sharing options...
BlueSkyIS Posted December 30, 2010 Share Posted December 30, 2010 depends on server config. apparently your server is config'ed so it's not possible. Link to comment https://forums.phpfreaks.com/topic/223022-question-on-directory-listing/#findComment-1153089 Share on other sites More sharing options...
jimbowvu80s Posted December 30, 2010 Author Share Posted December 30, 2010 Are you refering to the PHP.ini file or the web.config file? Link to comment https://forums.phpfreaks.com/topic/223022-question-on-directory-listing/#findComment-1153110 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.