Cordova multiple fileTransfer.upload() promises

Hi, i’m trying to loop fileTransfer.upload()
but somehow it keep looping continuously until line ‘console.log(’‘here2);’
like it doesnt even ecexute the fileTransfer.upload() line

im not sure what went wrong

  cloudinaryUpload(data,tag,folder): Promise<any>{
    return new Promise((resolve,reject) => {
      var returnData = [];
      let i=0;
      while(i < data.length){
        console.log(i);
        let options: FileUploadOptions = {}
        let url = 'something';
        console.log(url);
        this.cloud_upload(data[i].uri, url, options).then((res) => {
          console.log(res);
          returnData.push(res);
          i++;
          if(i == data.length){
            resolve(returnData);
          }
        })
      }
    });
    }
    
    cloud_upload(uri, url, options): Promise<any>{
    console.log('here');
    const fileTransfer: FileTransferObject = this.transfer.create();
    return new Promise((resolve,reject) => {
      console.log('here2');
      fileTransfer.upload(uri, url, options).then(data => {
        console.log(data);
        resolve(data);
      })
      .catch(err => {
        console.log(err);
        reject(err);
      });
    });
    }