一键单击html上传文件(图片)

I'd like to upload a file in one click, so I tried to combine two click events in one, but the $_FILE variable does not load the image, here's my code :

    <form target='_self' action='upload.php' method='post' enctype='multipart/form-data'>
        <div class = 'testocentrato'>
        <input style='display:none' type='file' accept='.jpg' name='file' id='file'/>
        <input style='display:none' type='submit' id='caricaimmagine' name='caricaimmagine' />
        <input class='inputfile' type='button' value='Scegli file da PC' onclick='document.getElementById('file').click(); document.getElementById('caricaimmagine').click();' />
        <input style='display:none' type='submit' />
        <input class='inputfile' type='submit'  name='eliminaimmagine' onclick='document.getElementById('eliminaimmagine').click();' value='".$lang['TASTO_ELIMINA_FOTO']."' />
        <input type='hidden' name='id_utente' value='".$user['id']."' />        
   </form>

Because you are directly clicking on submit before secting the file. Remove document.getElementById('caricaimmagine').click(); You need to click that button manually.