title: How can i upload multiple files in node.js?
body: <p>I need help in upload multiple files using node.js upload file reader.</p>
  
  <p>I am using the <code>fs = require('fs')</code>.
  I have problem  in  choose two files,only one file only write in upload directory.</p>
  
  <p>This is my backend</p>
  
  <pre><code>var files = req.files.files[0];
  for (var i = 0; i &lt; files.length; i++) {    
    file = files[i];
    fs.readFile(files[i].path, function(error, data) {
      // console.log( files[i].path ) ,here displayed two same both
      fs.writeFile(uploadDirectory() + newFileName, data, function(error) {
      });
    });
  }
  </code></pre>
  
  <p>Please help me.
  what is the problem in my code.
  Thanks.</p>