Parse Uploaded CSV file using D3.js
<p>I'm new to d3.js so I know this might seem as a silly question to some so please bear with me. I'm trying to parse a csv file which a user uploads and print it's output in the console. I'm able to parse the CSV file when I provide the absolute path of the CSV file but when I try doing the same with file upload functionality I'm not getting any output in the console..</p>

<p><strong>Working Javascript Code</strong>..</p>

<pre><code>    var dataset = [];
    d3.csv("sample.csv", function(data) {
    dataset = data.map(function(d) { return [ d["Title"], d["Category"], d["ASIN/ISBN"], d["Item Total"] ]; });
    console.log(dataset[0]);
    console.log(dataset.length);
    }); 
</code></pre>

<p><strong>Console Output</strong>...</p>

<pre><code>["Men's Brooks Ghost 8 Running Shoe Black/High Risk Red/Silver Size 11.5 M US", "Shoes", "B00QH1KYV6", "$120.00 "]
 8
</code></pre>

<p><strong>New HTML code</strong>..</p>

<pre><code>    &lt;input type="file" id="csvfile" name="uploadCSV"/&gt;
    &lt;br/&gt;
    &lt;button onclick="howdy()"&gt;submit&lt;/button&gt;
</code></pre>

<p><strong>Modified Javascript Code(not working)</strong>..</p>

<pre><code>    var myfile = $("#csvfile").prop('files')[0];
    var reader = new FileReader();

    reader.onload = function(e) {
    var text = reader.result;
    }

    reader.readAsDataURL(myfile);

     var dataset = [];
    d3.csv(reader.result , function(data) {
    dataset = data.map(function(d) { return [ d["Title"], d["Category"], d["ASIN/ISBN"], d["Item Total"] ]; });
    console.log(dataset[0]);
    console.log(dataset.length);
    })
</code></pre>

<p>Since there was no official documentation on how to handle user uploaded CSV file I can't figure out where I'm going wrong..Is there a way I can use HTML5 file reader?? Please help.. </p>