i have the following piece of code:
Code: Select all
$dir_an = "./doc/arhiva_hotarari/".$_GET['an']."/";
if($deschidere_an = opendir($dir_an)) {
while(FALSE !== ($hotarare = readdir($deschidere_an))) {
if($hotarare != "." && $hotarare != ".." && $hotarare != "index.html") {
$titlu_txt = $hotarare;
if(file_exists($dir_an.$titlu_txt)) {
@chmod($dir_an.$titlu_txt, 0777);
$deschidere = fopen($dir_an.$titlu_txt, "r");
$titlu_hot = fread($deschidere, filesize($dir_an.$titlu_txt));
fclose($deschidere);
clearstatcache();
}
$sablon->AsociazaValoriBloc("an", array(
'HOTARARE' => $titlu_hot)
);
}
}
}The code reads the content of the $dir_an (witch is a folder) extracts the files in there, reads the contents of thoes files and output the result.
Now, the problem is: in that folder are two filetypes: TXT and JPG. I want to read the content ONLY for TXT files, i'm not intersted in the content of the JPG files... how do i do that ?
Please note that i don't have control over the filenames... someone just uploads them via forms...
Thank you in advance and excuse my english