title: looking to upload multiple images with express-fileupload
body: <p>looking to upload multiple images i am able to do it individually as in code but now i want all gallery images to be sent in a single input and support multiple uploads without restricting numbers here is my code. </p>
  
  <pre><code> router.post('/add-product', isAdmin, function (req, res, next) {
      console.log(req.files);
      errorMsg = req.flash('error')[0];
      successMsg = req.flash('success')[0];
      var imageFile, imageFile1, imageFile2, imageFile3;
  
      if (!req.files) {
          res.send('No files were uploaded.');
          return;
      }
      imageFile = req.files.imageFile;
      imageFile1 = req.files.imageFile1;
      imageFile2 = req.files.imageFile2;
      imageFile3 = req.files.imageFile3;
      imageFile.mv('public/images/' + req.user._id + req.body.code + req.body.name + '.png', function (err) {
          if (err) {
              res.status(500).send(err);
          }
      });
  
      imageFile1.mv('public/images/' + req.user._id + req.body.code + req.body.name + 'g1' + '.png', function (err) {
          if (err) {
              res.status(500).send(err);
          }
      });
  
      imageFile2.mv('public/images/' + req.user._id + req.body.code + req.body.name + 'g2' + '.png', function (err) {
          if (err) {
              res.status(500).send(err);
          }
      });
  
      imageFile3.mv('public/images/' + req.user._id + req.body.code + req.body.name + 'g3' + '.png', function (err) {
          if (err) {
              res.status(500).send(err);
          }
      });
      product = new Product({
          name: req.body.name,
          code: req.body.code,
          Wifi: req.body.Wifi,
          campfire: req.body.campfire,
          Pool: req.body.Pool,
          parking: req.body.parking,
          title: req.body.title,
          Duration: req.body.Duration,
          Product_Group: req.body.Product_Group,
          price: parseFloat((req.body.price * 100).toFixed(2)),
          description: req.body.description,
          shippable: req.body.shippable,
          taxable: req.body.taxable,
          category: req.body.category,
          Longitude: req.body.Longitude,
          Latitude: req.body.Latitude,
          imagePath: '/images/' + req.user._id + req.body.code + req.body.name + '.png',
          imagePathg1: '/images/' + req.user._id + req.body.code + req.body.name + 'g1' + '.png',
          imagePathg2: '/images/' + req.user._id + req.body.code + req.body.name + 'g2' + '.png',
          imagePathg3: '/images/' + req.user._id + req.body.code + req.body.name + 'g3' + '.png',
      });
      console.log(product);
      product.save(function (err) {
          if (err) {
              req.flash('error', 'Error: ' + err.message);
              return res.redirect('/admin/products');
          }
          //console.log("product: " + product);
          return res.redirect('/admin/products');
  
      });
  });
  </code></pre>
  
  <p>the front part is as in the below code html part of the same with different inputs for different images but now looking to make multiple inputs for the same the node module supporting the function is express-fileupload</p>
  
  <pre><code>&lt;div class="form-group"&gt;
          &lt;ul class="list-group"&gt;
              &lt;li class="list-group-item"&gt;
                  &lt;label for='imageFile'&gt;Display Image&lt;/label&gt;
                  &lt;input type='file' name='imageFile' class='form-control'&gt;
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;ul class="list-group"&gt;
              &lt;li class="list-group-item"&gt;
                  &lt;label for='imageFile1'&gt;Gallery1&lt;/label&gt;
                  &lt;input type='file' name='imageFile1' class='form-control'&gt;
  
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;ul class="list-group"&gt;
              &lt;li class="list-group-item"&gt;
                  &lt;label for='imageFile2'&gt;Gallery2&lt;/label&gt;
                  &lt;input type='file' name='imageFile2' class='form-control'&gt;
  
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;ul class="list-group"&gt;
              &lt;li class="list-group-item"&gt;
                  &lt;label for='imageFile3'&gt;Gallery3&lt;/label&gt;
                  &lt;input type='file' name='imageFile3' class='form-control'&gt;
  
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
  </code></pre>