DaHax Posted August 18, 2010 Share Posted August 18, 2010 I am working on a little project for my site and I am trying to get this script to ignore the index.html file and the .htaccess file in there. I just want it to display all files like .zip, .rar, .tar, .gz, .gtar, .ace, ect... echo " <td width='70%'><select id='download'>"; echo " <option value=''>None</option>"; if ($handle = opendir("./modules/Downloads/files")) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo " <option value='".$file."'>".$file."</option>"; } } closedir($handle); } echo " </td>\n"; Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 18, 2010 Share Posted August 18, 2010 Change this line if ($file != "." && $file != "..") { to if (!in_array($file, $filesToIgnore)) { Now before the while() loop define an array of files you want your script to ignore $filesToIgnore = array('.', '..', '.htaccess', 'index.html'); Quote Link to comment 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.