zoukankan      html  css  js  c++  java
  • js获取上传文件的绝对路径

    在html中
        <input type="file" id="importFile" />
        <input type="button" onclick="upload()"/>

    <script>
    function upload() {
        var filename = document.getElementById("importFile").value;
        // 这时的filename不是 importFile 框中的值
        alert(filename);
    }
    </script>

    如上面的代码,用文件上传对话框选择文件后,如果选择"D:\tempfile est.txt"文件,alert(filename)却是"C:\fakepath est.txt"这是为什么?我想要取得原本的文件路径及文件名,应该怎么办?先谢谢各位了。

  • 相关阅读:
    python-day49--前端 css-层叠样式表
    python-day49--前端 html
    python-day48--mysql之视图、触发器、事务、存储过程、函数
    python-day47--pymysql模块
    python-day47--mysql数据备份与恢复
    python-day46--前端基础之html
    python-day45--mysql索引
    window系统下远程部署Tomcat
    tomcat下部署应用helloworld
    tomcat配置文件context.xml和server.xml分析
  • 原文地址:https://www.cnblogs.com/zhujiabin/p/4971091.html
Copyright © 2011-2022 走看看