metti un campo file al posto di un campo di input

<input type='file' name='logo'>

e poi da php con una funzione tipo questa la carichi :

Codice PHP:

function Upload$nome$percorso )
{
if(
$_FILES[$nome]['error']==4)
        {
            
$nuovo_nome=$percorso."generica.jpg";
            
print_r($_FILES);
            
//exit;
        
}
    else
        { 
            
$file_temp=($_FILES[$nome]['tmp_name']);  
            
$inviato=file_exists($file_temp);
                        
            if (
$inviato
                {
                    
$nuovo_nome=$percorso.rand(4,1983).".jpg";
                    
move_uploaded_file($file_temp,$nuovo_nome);
                    echo 
"CARICATO";
                } 
            else 
                {
                    echo
"ERRORE CARICAMENTO FILE";
                    exit;
                }
        }
    return 
$nuovo_nome;