Salve a tutti.
Vorrei un aiuto sulla funzione header per il redirect in php.

Codice PHP:
if (!headers_sent()) {
        if (
$rows == 0) {    
            
header('Location:add-autore.php?insert=false');
        } else {    
            
header('Location:add-autore.php?insert=true');
        };
    }; 
Ma va in errore sempre.
Nel codice in alto faccio un upload ma non scrivo nulla prima del header.
Da cosa potrebbe dipendere ? Come controllo ?
Grazie