用硬编码路径替换html5上传功能

时间:2014-01-21 18:10:32

标签: javascript php html csv

我正在尝试使用脚本显示.csv文件并进行内容过滤和搜索。 我找到了this script on github

我想将此脚本放在我的网络服务器(apache)上。 这很好,但是,我希望它能够与位于同一文件夹中的一个或多个.csv文件一起使用。

我的目标是在加载index.html时,它直接在.csv中硬编码的路径中显示(并处理)index.html.文件 .csv文件位于index.html所在文件夹中的子文件夹中(如./files/document.csv

简而言之:

  • 删除上传功能;
  • 在index.html
  • 中放置“path to file”
  • 当index.html加载时,它应该加载并处理“path to file”
  • 中指定的文件

我的猜测是需要更改的代码将是index.html中的代码:

<div class="container">
    <form class="form">
        <input type=file id=files name=files[] class='btn'/>
        <output id=list></output>

1 个答案:

答案 0 :(得分:1)

在评论中回答,这是一个片段:

谢谢,我用这个代码加载了它:代码:function ajax(a,b,c){//url,function,just a placeholder c=new XMLHttpRequest; c.open('GET',a); c.onload=b; c.send() } function alertTxt(){ alert(this.response) } window.onload=function(){ ajax('bad.csv') }

相关问题