So i want to read some uploaded files(json or txt) content and then store it in local variable. I tried the fetch method but still nothing showing. heres my code:
var upload_files = document.getElementById("upload-btn");
upload_files.addEventListener("change", function() {
fetch(upload_files.value)
.then((res) =>{
return res.text();
}).then((data)=>{
console.log(data)
var file_conent = data
})
})
anyone got any idea?