title: Getting this typeerror while uploading in node js
body: <p>this is what i am getting as an error</p>
  
  <pre><code>TypeError: Cannot read property 'file' of undefined
      at C:\node\project\server.js:17:25
      at Layer.handle [as handle_request] (C:\node\node_modules\express\lib\router\layer.js:95:5)
      at next (C:\node\node_modules\express\lib\router\route.js:137:13)
      at Route.dispatch (C:\node\node_modules\express\lib\router\route.js:112:3)
      at Layer.handle [as handle_request] (C:\node\node_modules\express\lib\router\layer.js:95:5)
      at C:\node\node_modules\express\lib\router\index.js:281:22
      at Function.process_params (C:\node\node_modules\express\lib\router\index.js:335:12)
      at next (C:\node\node_modules\express\lib\router\index.js:275:10)
      at Immediate.&lt;anonymous&gt; (C:\node\node_modules\multer\lib\make-middleware.js:53:37)
      at runCallback (timers.js:670:20)
  </code></pre>
  
  <p>my html code</p>
  
  <pre><code>  &lt;form action = "http://127.0.0.1:8081/file_upload" method = "POST" 
       enctype = "multipart/form-data"&gt;
       &lt;input type="file" name="file" size="50" /&gt;
         &lt;br /&gt;
       &lt;input type = "submit" value = "Upload File" /&gt;
    &lt;/form&gt;
  </code></pre>
  
  <p>my js code</p>
  
  <pre><code>console.log(req.file.file.name);
  console.log(req.file.file.path);
  console.log(req.file.file.type);
  var file = __dirname + "/" + req.file.file.name;
  </code></pre>
  
  <p>where im doing wrong?</p>