飞不起来的小菜鸟 2017-04-26 03:24 采纳率: 0%
浏览 3135
已采纳

Chrome浏览器中file表单获取物理路径

为啥我获取到的路径都是获取的路径
请问各位大神,怎么获取全部路径?

 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Student_List.aspx.cs" Inherits="StudentList.Student_List" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="jquery-1.11.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#fileField").change(function () {
                var path = $("#fileField").val;
                $("#test").text(path);
            });
        });
    </script>
    <style type="text/css">
        .contents
        {
            width: 100%; height:600px;
            background-color: #dfdfdf;
            margin: 10px auto;
        }
        .file-box
        {
            position: relative;
            width: 340px;
        }
        .txt
        {
            height: 22px;
            border: 1px solid #cdcdcd;
            width: 180px;
        }
        .btn
        {
            background-color: #FFF;
            border: 1px solid #CDCDCD;
            height: 24px;
            width: 70px;
        }
        .file
        {
            position: absolute;
            top: 0;
            right: 80px;
            height: 24px;
            filter: alpha(opacity:0);
            opacity: 0;
            width: 260px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="file-box">
        <input type='text' name='textfield' id='textfield' class='txt' />
        <input type='button' class='btn' value='浏览...' />
        <input type="file" name="fileField" class="file" id="fileField" size="28" onchange="document.getElementById('textfield').value=this.value" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"/>
        <input type="submit" name="submit" class="btn" value="上传" />
    </div>
    <div class="contents">
        <span id="test"></span>
    </div>
    </form>
</body>
</html>

  • 写回答

1条回答

  • Go 旅城通票 2017-04-26 04:46
    关注

    无法获取,安全问题不允许获取客户端路径,而且获取这个路径也没有意义。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 虚拟机打包apk出现错误
  • ¥30 最小化遗憾贪心算法上界
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝