javascript – Rename a file with multiple downloads

I have a form that contains a file type entry, where I have to send multiple files at the same time:

no ts i do like this:

        public uploader: FileUploader = new FileUploader ({
isHTML5: true
});

        constructor () {}

...

onSubmit (form) {

for (var j = 0; j < this.uploader.queue.length; j++) {
              this.enviaFoto = new FormData();

              this.fileItem = this.uploader.queue[j]._file;

       this.enviaFoto.append('photo', this.fileItem, this.fileItem.name);
      this.enviaFoto.append('fileSeq', 'seq' + j);
      this.uploadFile(this.enviaFoto).subscribe(data => 
           }
this.uploader.clearQueue ();
}


uploadFile (data: FormData): Observable {

send back this.http.post(& # 39; http: // localhost: 3000 / novaphoto & # 39; date);
}

The files are inserted in my good API, but then I have to rename the files before sending them and I have followed:

onSubmit (form) {

        for (var j = 0; j <this.uploader.queue.length; j ++) {
this.enviaFoto = new FormData ();

this.fileItem = this.uploader.queue[j]._file;


if (this.day3.DIA === this.finalResultTotal[0].DATA_DIA) {
this.day3.HORA = this.finalResultTotal[0].HORS
this.day3.SOBRA = this.finalResultTotal[0].TOTAL

this.Day1Final = this.day3


} else {

}

if (this.day3.DIA === this.finalResultTotal[1].DATA_DIA) {
this.day3.HORA = this.finalResultTotal[1].HORS
this.day3.SOBRA = this.finalResultTotal[1].TOTAL

this.Day2Final = this.day3

} else {

}

    if (this.Day1Final.UPLOAD) {

Object.defineProperty (this.fileItem, & # 39; name,
writable: true,
value: (this.Day1Final) .trim ()
});
this.enviaFoto.append (& # 39 ;, this.fileItem, this.fileItem.name);
this.enviaFoto.append (& # 39; fileSeq, & # 39; seq & # 39; + j);
this.uploadFile (this.enotePhoto) .subscribe (data => console.log (data.message));
}

if (this.Day2Final.UPLOAD) {
let photo = new FormData ()
Object.defineProperty (this.fileItem, & # 39; name,
writable: true,
value: (this.Day2Final) .trim ()
});
photo.append (& # 39 ;, this.fileItem, this.fileItem.name);
photo.append (& # 39; fileSeq, & # 39; seq & # 39; + j);
this.uploadFile (photo) .subscribe (data => console.log (data.message));

}

}
this.uploader.clearQueue ();
}

If this.Day1Final.UPLOAD is true, it means that there is a file in this array, just like Day2Final.

Sending to api and is sent successfully, name of the way I want, but do not go the different photos, it sends the same photo only with different names.

Could you help me?