dongtanjian9310 2019-05-02 08:29
浏览 744

文件上传时间(document.getElementById(“file”)。files [0] .name)获取错误

In javascript (document.getElementById("file").files[0].name) is giving not able to the file name for the loacl sever

Error:Uncaught TypeError: Cannot read property 'name' of undefined

HTML

<?php $j=10; for($i=0; $i<=$j;$i++){?><div>

    <a href="#" title="Give some input related to this track" data-toggle="modal" data-target=".bs-example-modal-lgdata<?php echo $i;?>"><i class="fa fa-pencil-square-o"></i></a>
<div class="modal fade bs-example-modal-lgdata<?php echo $i;?>" tabindex="-1" role="dialog" aria-hidden="true">
<form  data-parsley-validate class="form-horizontal form-label-left" action="../text.php" method="post">

    <input type="file" name="file" id="file" multiple="multiple" required >

     </p> 
     <span id="uploaded_image"></span>

      <div>

       </div>
 </div>
</div>
<?php }?>

javascript

 <script>

                $(document).ready(function(){

                 $(document).on('change', '#file', function(){
                  $('div.loader').show();

                  var name = document.getElementById("file").files[0].name;
               });

               });

             </script>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 matlab图像高斯低通滤波
    • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
    • ¥15 钢筋实图交点识别,机器视觉代码
    • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
    • ¥50 400g qsfp 光模块iphy方案
    • ¥15 两块ADC0804用proteus仿真时,出现异常
    • ¥15 关于风控系统,如何去选择
    • ¥15 这款软件是什么?需要能满足我的需求
    • ¥15 SpringSecurityOauth2登陆前后request不一致
    • ¥15 禅道二次开发编辑版本,上传不了发行包