qq_29107721
飞不起来的小菜鸟
2017-04-26 03:24

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

  • 浏览器
  • chrome
  • 表单

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

 <%@ 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条回答

为你推荐