title: How to display uploaded text file in webpage using NODE js/html
body: <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;body&gt;
  
        &lt;form action    =  "/submit"
               method    =  "post"&gt;
          Select a file: &lt;input type="file" name="file"&gt;
          &lt;input type="submit"&gt;
        &lt;/form&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Really simple, the webpage will ask for csv file, then user presses submit. The whole point is to then display the content of that csv file in the /submit page. </p>
  
  <p>Node js </p>
  
  <pre><code>var http = require('http');
  var express= require('express')
  var fs = require('fs');
  var util = require('util');
  var app= express();
  var multer = require('multer');
  //var bodyParser = require('body-parser');
  //var dispatcher = require('httpdispatcher');
  
  app.use(bodyParser.urlencoded({ extended: false }));
  app.use(bodyParser.json());
  
  app.get('/', function(req, res){
      var html = fs.readFileSync('index2.html');
      res.writeHead(200, {'Content-Type': 'text/html'});
      res.end(html);
  });
  
  
  app.post('/submit', upload.single('File'), function(req,res) {
  
  });
  
  //Listening to computer's IP address
  app.listen(3000, "192.168.0.172");
  console.log('Listening at 192.168.0.172:3000')
  </code></pre>
  
  <p>I create a side program that takes in csv file and parses it. I want this program to run on the file that the client uploads. </p>
  
  <pre><code>var columns = ["Parameter", "Address", "Data Size"];
  require("csv-to-array")({
     file: "parse1.txt",
     columns: columns
  }, function (err, array) {
    console.log(err || array);
  });
  </code></pre>
  
  <p>How can i use the code above in the post function in the node js program??</p>