Ecco il codice:
Codice PHP:
function carvuota($dir) {
    
$content = Array();
    
$handle opendir($dir);
    while (
false !== ($entry readdir($handle))) {
        if (
$entry != "." && $entry != ".."){
            
$content[] = $entry;
            }
    }
    
closedir ($handle);
    if(
count($content)>0) {
        return 
true;
    } else {
        return 
false;
    }

Codice PHP:
<?php if (carvuota($cartella_download)) :?>
<p>Nessun file scaricabile.</p>
<?php else: ?>
Lo script mi dice che la cartella è vuota anche quando è piena.