i am transferring file to a url, i could do it successfully but i dont know how to get the progress of the file that is been uploaded, i need to get progress in some numbers
You can show progressBar by using onProgress function like this
public fileTransfer: TransferObject = this.transfer.create();
public upload(path,folder)
{
url="http://www.axmag.com/download/pdfurl-guide.pdf";
var trustHosts = true;
this.presentLoading("Loading");
//**Progress Bar**
this.fileTransfer.onProgress((e)=>
{
let prg=(e.lengthComputable) ? Math.round(e.loaded / e.total * 100) : -1;
console.log("progress:"+prg);
});
this.fileTransfer.upload(file_path, api_endpoint, options, data).then((entry) => {
//handle success
console.log('upload complete: ' );
},
(error) => {
this.loader.dismiss();
alert('uploading faild: ');
console.log(error);
//handle error
});
}
Now you can call upload() function to upload a file