DJTim666 Posted October 7, 2007 Share Posted October 7, 2007 I am building a control panel for a hosting website, and I was wondering if there is a way to display all the files in a directory . -- DJ Quote Link to comment https://forums.phpfreaks.com/topic/72217-solved-print-all-files-in-a-directory/ Share on other sites More sharing options...
Wolphie Posted October 7, 2007 Share Posted October 7, 2007 The most basic of what you mean: <?php //Open the directory $dir = dir("dir_name"); //List files in the directory while (($file = $dir -> read()) !== false) { echo "Filename: " . $file . "<br />"; } $dir -> close(); ?> Output will be: filename: . filename: .. filename: google.gif filename: pulse.exe filename: example.pdf filename: images.zip Etc.. Quote Link to comment https://forums.phpfreaks.com/topic/72217-solved-print-all-files-in-a-directory/#findComment-364137 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.