0

In a web page I have this HTML code:

    function inviaDocumentoAjax(formId) {
        inviaDocumentoAjaxByForm();
        document.getElementById("file_1053761667559715321").value = null;
    }

    function uploadFile(target){
        document.getElementById("file_1053761667559715321").value = target.files[0].name;
    }
<table align="left" border="0" class="very compact table rounded">
    <tbody>
        <tr>
            <td>
                <div style="position:relative;">
                    <input type="text" id="file_1053761667559715321" style="position:absolute;" placeholder="Clicca qui per selezionare un file  ">
                        <input type="file" name="documento" title="" style="opacity:0; z-index:1;" onchange="uploadFile(this)" class="ui primary button">       
                </div>
            </td>
            <td>              
            </td>
        </tr>
        <tr>
            <td>
                <input type="button" value="Carica  " style="background-color:#1678c2;background:#1678c2;height:20px;width:56px;padding:0px" onclick="inviaDocumentoAjax();" class="ui primary button">      
            </td>
        </tr>
    </tbody>
</table>

I try to open input file explorer using JavaScript without success.

Does anyone know how I can do this?

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
Stefano
  • 7
  • 3

1 Answers1

0

You can open it by firing this line of code wherever you want it to open

document.getElementById("file_1053761667559715321").click();
//this line of code will open the file explorer
Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122