Salve, ho un problema con questo pezzo di codice:

codice:
foreach ($reversed as $nomefile) {    
    $f = file_get_contents("$path_event/$nomefile"); // $nomefile è il nome del file di testo
    
    echo "<a href=eventdelconfirm.php?del=$nomefile><img src=\"images/icons/trash.png\" title=\"Cancella\" width=\"15\" height=\"15\"></a>";
    echo "&nbsp;";
    echo "<a href=eventpostedit.php?edi=$nomefile><img src=\"images/icons/edit.png\" title=\"Modifica\" width=\"15\" height=\"15\"></a>";
    echo "&nbsp;";
    
    $nomefile = file_get_contents("$path_event/$nomefile");
    $nomefile = explode("|", $f);
        
        $titleev = $nomefile[0];
        $monthev = $nomefile[2];
        $yearev = $nomefile[3];
        
        $nameev = str_replace(" ", "_", "$titleev");
        
        $dir_name = "$yearev%a%$monthev%b%$nameev";
    
    echo "<a href=filesupl.php?upl=$dir_name><img src=\"images/icons/upload.png\" title=\"Carica file\" width=\"15\" height=\"15\"></a>";                             
    echo "&nbsp;";
    echo "<a href=galleryupl.php?gal=$dir_name><img src=\"images/icons/gallery.png\" title=\"Carica foto\" width=\"15\" height=\"15\"></a>";    
    
    echo "&nbsp;&nbsp;&nbsp;&nbsp; $titleev <br>";
    
}

?>

Quello che succede è che non riesco a passare $dir_name a filesupl.php e a galleryupl.php: dove sbaglio?
Grazie!