Skip to content
Advertisement

replace html5 upload function with hardcoded path

I’m trying to use a script to display a .csv file and make content filter and searchable. I found this script on github:

I want to put this script on my webserver (apache). That works great, however, I want it to work with 1 or more .csv files that resides on the same folder.

My goal is that when the index.html is loaded, it directly displays (and handles) a .csv file from a path that is hardcoded in the index.html. The .csv file is in a subfolder within the folder where index.html resides ( like ./files/document.csv)

So in short:

  • Remove the upload function;
  • place “path to file” in the index.html
  • When index.html loads, it should load and process the files that is specified in the “path to file”

My guess would be that the code that needs to be altered would be this in index.html:

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

Advertisement

Answer

Answered in comments, Here’s a snippet:

Thanks, i got it loaded with this code: code: 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') }

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement