I want to get and read a JSON file that would be uploaded by the user.
I created the html input file:
<div id="button_open" class="button">
<span>Open a JSON file</span>
<input id="input_open" class="input_file" type="file">
</div>
And now, I don't know how to load the data from the file. I only can get the filename.
Here is what I wrote:
$(document).ready(function(){
$("#input_open").change(onOpenChange);
})
function onOpenChange(e) {
var filname = $("#input_open").val();
var fileContent = ... ?
var jsonData = JSON.parse(fileContent);
}
Anyone knows how to get the file content?