<?PHP 
$savefileImg="./../".$SYSD."/".$filename2."-image-list2.inc.php";
if (file_exists($savefileImg)){unlink($savefileImg);}

$folderImg=opendir ($imagesDirX);
while ($dataImg=readdir ($folderImg)){
$arrImg[] = $dataImg;
}
closedir($folderImg);
natcasesort ($arrImg);
foreach($arrImg as $resultImg)
if($resultImg != '.' && $resultImg != '..' && $resultImg != 'syslms')
{
$resultImgZ=$lpRouting."/".$imagesF."/".$resultImg;
$resultImgX="<option value='".$resultImgZ."'>".$resultImgZ."</option>";

$handle=fopen($savefileImg, "a+");
fwrite($handle,$resultImgX."\n");
fclose($handle);
$oldumask = umask(0);
chmod($savefileImg, 0644);
umask($oldumask);
}

if (file_exists($savefileImg)){}else{
copy("./../".$SYSI."/".$filenameD."/prg-img/image-list2.inc.php" , "./../".$SYSD."/".$filename2."-image-list2.inc.php");
}
?>