title: nodejs express and file uploading
body: <p>Ok so ive already tried using connect-form and I couldnt get it working for some reason, but I figure I should understand how this works semi from scratch regardless.</p>
  
  <p>I dont understand where the multipart/formdata file which I am uploaded is going, or how I can access it in my app when its posted to the url. -- Id like to access the file data directy, and write the file output using the node fs module. -- For instance:</p>
  
  <pre><code>    app.post('/testy', function(req, res){
         console.log(req.body);
         console.log(req.headers);
         res.redirect('back');
  
      });  
  
      app.get('/testy', function(req, res){
        res.send('&lt;form method="post" action="/testy" enctype="multipart/form-data"&gt;'
          + '&lt;p&gt;Image: &lt;input type="file" name="test" /&gt;&lt;/p&gt;'
          + '&lt;p&gt;&lt;input type="submit" value="Upload" /&gt;&lt;/p&gt;'
          + '&lt;/form&gt;');
      });
  </code></pre>
  
  <p>So the only req var that is actually being logged there is the req headers, body is empty. (probably supposed to be I understand that). But what I dont get is where is the file data? Looking for the php equiv of the $_FILES array I supposed. -- Here is my headers logged.</p>
  
  <pre><code>'accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  'accept-language': 'en-us,en;q=0.5',
  'accept-encoding': 'gzip,deflate',
  'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
  'keep-alive': '115',
  connection: 'keep-alive',
  referer: 'http://127.0.0.1:3000/testy',
  cookie: 'connect.sid=lDRpluTxjUJeuTmkXlybrYeZ.JYTB155s2DGce2dsyfv1Op5ISCY8uqyqJZK8NjlZ5jM; socketio=flashsocket',
  'x-insight': 'activate',
  'content-type': 'multipart/form-data; boundary=---------------------------5856401949371863571646035001',
  'content-length': '30128' }
  </code></pre>
  
  <p>Any light shed upon what Im missing as always much appreciated!</p>