1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$clientnumber = "myfolder/"; $pdffiles = array(); $valid_files = array('pdf'); if(is_dir($clientnumber)){ foreach(scandir($clientnumber) as $file){ $ext = pathinfo($file, PATHINFO_EXTENSION); if(in_array($ext, $valid_files)){ array_push($pdffiles, $file); } } } echo json_encode($pdffiles); |
