title: Encountering "cannot read property 'length' of undefined"
body: <p>Having some weird errors with my nodejs server which I previously was't encountering. I get the error: 
  "TypeError: Cannot read property 'length' of undefined" 
  I am using formidable to process any formdata from my html page. Tried a lot of things to fix it, and looked online to people with similar problems but without any results. This is my code:</p>
  
  <pre><code>var http = require('http');
  var fs = require('fs');
  var formidable = require("formidable");
  var util = require('util');
  var exec = require('child_process').exec;
  
  
  var ram;
  var disk;
  var cpu;
  var port = 80;
  var ip = "172.19.0.1";
  
  //als de user request doet naar form forward dan naar displayForom, else naar processallfieldsoftheForm om 
  //invoer van de gebruiker te verwerken
  
  var server = http.createServer(function (req, res) {
      if (req.method.toLowerCase() == 'get') {
          displayForm(res);
  
      } else if (req.method.toLowerCase() == 'post') {
          processAllFieldsOfTheForm(req, res);
      }
  });
  
  //geef de html form weer 
  function displayForm(res) {
      fs.readFile('form.html', function (err, data) {
          res.writeHead(200, {
              'Content-Type': 'text/html',
          'content-length' : data.length
          //error is here
          });
      res.write(data);
          res.end();
      });
  }
  
  
  //functie om invoer van de gebruiker te verwerken serverside en als variabele op te slaan.
  function processAllFieldsOfTheForm(req, res)  { 
  var form = new formidable.IncomingForm();
  form.parse(req, function (err, fields, files) 
  {
      ram = (fields.mem)
      disk = (fields.dsk)
      cpu = (fields.cpu);
  }
          );
              }
  
  
  //exec('cat /home/js/text123', function(err, stdout, stderr){
  //console.log(stdout);
  //});
  
  
  //serverside logs om te illistreren waar de server naar luistert, en waar hij luistert
  server.listen(port, ip);
  console.log("server lisening on " + port + " adress: " + ip);
  </code></pre>