<input type="file" id="file" name="file" />
if ( ! (window.File && window.FileReader && window.FileList && window.Blob)) {
  alert('The File APIs are not fully supported in this browser.');
}

function handleFileSelect(evt) {
    var file = evt.target.files[0];
    if (!file.type.match('text.*')) {
		    return alert(file.name + " is not a valid text file.");
    }
    var reader = new FileReader();
     reader.readAsText(file);
     reader.onload = function (e) {
       var textToArray = reader.result.split("\n").map(function(x){return x.split(",")});
       console.log(textToArray); 
     };
 }

window.onload = function () {
 document.getElementById('file').addEventListener('change', handleFileSelect, false); 
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.