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 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.. 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
Archived
This topic is now archived and is closed to further replies.