PHP, Ajax - access all files and folders on server and create file manager
I want to access all files and folders in a specific directory on server (for eg. "home"). Is there a way to do it? or i just need to say everything in database?
Also i want to create a kind of File Manager that mana开发者_开发百科ges all the files and folders in a specific directory on server (for eg. "home") like on windows we have file explorer.
Please help me...
Thank you for any help Regards
try this simple php snippet and customize it your own way:
<?php
$directory = "./";
//Directory is set;
$dir = opendir($directory);
//Opened the directory;
while($file = readdir($dir)){
//Loops through all the files/directories in our directory;
if($file!="." && $file != ".."){
if(is_dir($file)) echo '<strong>'.$file.'</strong><br>';
else echo $file."<br/>\n";
}
}
?>
it'll output all the files & folders(not the subfolder files) in the current/provided dir.
精彩评论