input type file 获得用户选择的一般方法

<script type="text/javascript">
    function ShowExcelFile() {
        var tempName = $("#selectOriginFile_CertificationTemplateSelect").val();
        if (tempName != null && tempName != "") {
            window.open("/home/ReadExcelFile?filename=" + encode(tempName), 'excel文件显示', 'height=768, width=1024,fullscreen=no, scrollbars=auto');
        }
    }
</script>


<div style="100%;height:100%; text-align:center; padding-top:300px;">
     请选择原始数据文件:
     <br />
        <input type="file" id="selectOriginFile_CertificationTemplateSelect"  title="选择" />
    <br />

    <h1>显示选择的文件</h1>
    <input type="button" value="显示" onclick="ShowExcelFile() " />
</div>
原文地址:https://www.cnblogs.com/wangxiuhui/p/3857372.html