首页javascriptfile_uploadJavascript Form - 如何获取文件上传输入字段值

Javascript Form - 如何获取文件上传输入字段值

我们想知道如何获取文件上传输入字段值。

<html>
    <body>
    <script language="JavaScript">
    function showname(){
        var  file = document.form1.uploadBox.value ;
        document.form1.filename.value = file ;
    }
    </script>
    <form name="form1">
    Click on browse to choose a file to send.
    <br>
    Click on the Send button to see the full path for the file sent.
    <br><br>
    File to send: <input type="file" name="uploadBox">
    <br><br>
    <input type="button" value="Send" name="get" onClick='showname()'>
    <br><br>
    <input type="text" name="filename" size="40">
    </form>
    </body>
</html>