title: how to save multiple files in gridFS in one request?
body: <p>I am working with nodejs and mongodb and wants to store multiple files at one time. I am using GridFS for files.</p>
  
  <p>My code works fine for single file upload. 
      var writestream = gfs.createWriteStream({ filename: filename, metadata:project._id});
                 console.log(tmpFilepath);  </p>
  
  <pre><code>            var filename    = req.files.file.name;
              var tmpFilepath="./upload/"+ guid();
              fs.rename(req.files.file.path,tmpFilepath);
              fs.createReadStream(tmpFilepath)
                .on('end', function() {
               console.log("file Saved");
                })
                .on('error', function() {
                 console.log("error encountered");
                 // res.send('ERR');
                })
                // and pipe it to gfs
                .pipe(writestream);
                  writestream.on('close', function (file) {
                  fs.unlink(tmpFilepath);
  
                });
  </code></pre>
  
  <p>how can I make it work for uploading multiple files?</p>