File upload with data


#1

I am uploading images to my server using cordova-plugin-file-transfer

var options = {
 fileKey: "avatar";,
 filename: filename,
 chunkedMode: false,
 mimeType: "image/png";
};

$cordovaFileTransfer.upload(url, targetPath, options)
 .then(function(result) {
  
 }, function(err) {
  
 });
}

And this is working fine, but I need to send some data with the file (description, user …) in order to properly save the uploaded file and add it to my database.

How can I send the file and the data together? thanks