How to use $cordovaFileTransfer upload multiple images?

filePath = ['xxxx','xxx'];
 $cordovaFileTransfer.upload(server, filePath, options)
.then(function(result) {

}, function(err) {
  // Error
  console.log(err);
}, function (progress) {
  // console.log(progress);
  });

but i get error message

[Error] Wrong type for parameter “filePath” of FileTransfer.upload:
Expected String, but got Array.checkArgs

You need to parse your array and send each file separately.

like this ?

$scope.imagen = [‘xxxxx’,‘xxxx’,‘xxxx’,‘xxxx’];
for (i=0; i<$scope.imagen.length; i=i+1)
{
filePath = $scope.imagen[i];
options.fileName = $scope.imagen[i].substr($scope.imagen[i].lastIndexOf(’/’)+1);
$cordovaFileTransfer.upload(server, filePath, options)
.then(function(result) {
console.log(result);
}, function(err) {
// Error
console.log(err);
}, function (progress) {
// console.log(progress);
});
}