I have a problem i simply want to browse file and upload to server. file could be of any type ( jpg, pdf, doc etc). To achieve it i used filechooser to browse file and $cordovaFileTransfer while browsing file its not give exact file name.
First resolve the native path & then give this path to FileTransfer plugin
fileChooser.open( function (fileUrl)
{
window.FilePath.resolveNativePath(fileUrl, function(filePath){
console.log(fileUrl);
$scope.$apply(function () { $scope.path = fileUrl; });
}, function(err){
$ionicPopup.alert({
title: ‘Error’,
template: err
});
});
},
function (error) { });
var options = { httpMethod: ‘POST’, chunkedMode : false, headers : { Connection: “close” }, framework: ‘Ionic’ };
var ft = new FileTransfer();
ft.upload($scope.path, encodeURI(configParamUrl+"/bulker/uploadpantan?emailId="+params.email+"&type=Pan"), win, fail, options); // This piece of line upload data.