title: Unique id (key) not changing for every post call to upload the image in aws s3 and so replaces the same image
body: <p>I am creating an angular application where I initiate a POST call from the client-side. In server-side, I have the route set up with multer-sharp-s3 where I generate a new name (key) and upload it to aws s3 every time when there is a call.</p>
  
  <p>Angular html code:</p>
  
  <pre><code>&lt;form&gt;
  &lt;input type="file" name='avatar' id="imageUploadInput" accept="image/*" #profilePicInput (change)="imageUpload(profilePicInput.files)" &gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Angular ts file:</p>
  
  <pre><code>imageUpload(fileList:FileList){
      this.fileToUpload= fileList.item(0);
      let formData = new FormData();
      formData.append('avatar', this.fileToUpload, this.fileToUpload.name );
      this.userService.uploadDpImage(formData, this.currentUser).subscribe(
        (data:{Message:string, location:string})=&gt;{
          this.userProfile.dpLocation=data.location;
        }
      )
    }
  </code></pre>
  
  <p>Nodejs Route with multer middleware:</p>
  
  <pre><code>router.post('/api/dpUpload/:displayName', middleWare.uploadToS3, (req,res)=&gt;{
       User.findOneAndUpdate(
           {displayName: req.params.displayName},
           {$set:{dpLocation: req.file.Location}},
           (err,obj)=&gt;{
               if(!err){
                  return res.json({Message: "Image uploaded successfully", location:req.file.Location});
               }else{
                  return res.json(err);
              }
           }
       )
  })
  </code></pre>
  
  <p>Multer middleware:</p>
  
  <pre><code>//S3 storage options
  var multer = require('multer');
  var s3Storage = require('multer-sharp-s3');
  var aws = require('aws-sdk');
  var fs = require('fs');
  var nodeuuid = require('node-uuid');
  
  aws.config.update({Bucket:'yaavarum-kelir-dev', region: 'us-east-2', accessKeyId: 'XXXXXXXXXXXX', secretAccessKey: 'XXXXXXXXXXXXX'});
  
  s3 = new aws.S3();
  
  var storage = s3Storage({
      s3,
      Bucket: 'yaavarum-kelir-dev',
      Key: `${'yaavarum-kelir-dev'}/DevContainer/${nodeuuid.v4()}`,
      ACL: 'public-read',
    });
  
  
  middleWareObj.uploadToS3=multer({
      storage: storage,
  }).single('avatar');
  </code></pre>
  
  <p>The problem that I am facing is that every time a post-call comes, the image is uploaded to aws s3 with the same name and so replaces the image instead of creating a new file. I am not sure what I am doing incorrectly.</p>
  
  <p>I am generating a new name by doing 'nodeuuid.v4()' in the 'storage' variable every time. But still, this issue is happening.</p>
  
  <p>Can someone please help?</p>