function getFileDirectory($path = '.', $ignore = '', $regexp = '|(.+)|') { //echo $path."\n"; $dirTree = array(); $dirTreeTemp = array(); $ignore[] = '.'; $ignore[] = '..'; $dh = @opendir($path); while (false !== ($file = readdir($dh))) { if (!in_array($file, $ignore)) { if (!is_dir("{$path}/{$file}")) { $reIgnore = 0; //for($i=0;$i<count($regexp_ignore);$i++){ if (preg_match($regexp, $file)) { $dirTree["{$path}"][] = $file; } } else { $dirTreeTemp = getFileDirectory("{$path}/{$file}", $ignore, $regexp); if (is_array($dirTreeTemp)) { $dirTree = array_merge($dirTree, $dirTreeTemp); } } } } closedir($dh); return $dirTree; }
<th>Type</th> <th>Size</th> </thead>'; $index = 1; echo '<tbody>'; foreach ($files as $file) { //$file = split("-", $file->filename); echo ' <tr> <td width="4%">' . $index . '</td> <td width="30%">' . $file->filename . '</td> <td width="27%">' . $file->caption . '</td> <td width="10%">' . number_format($file->size / 1024, 2) . 'kb</td> <form action="load.php" method="POST" target="_blank"> <td width="10%"><button type="submit" class="btn btn-default view-file" id="' . $index . '">View</button></td> <input type="hidden" id="' . $index . '-file" name="aid" value="' . getFileDirectory($file->filename, $file->caption) . '" /> </form> </tr>'; $index++; } echo '</tbody> </table>'; } ?> <h4 align="center" class="alert alert-success">Applicant's Eligibility</h4> <form method="POST" class="eligibility"> <table class="table table-bordered table-hover"> <thead> <th width="15%">Eligibility</th>