0
我试图建立一个应用程序使用Ionic和科尔多瓦,其功能的一部分是上传和下载文件从安全的位置,知道这样的命令正在使用卷曲,而我把我的凭据用户:通过的方式,但在科尔多瓦我使用$ cordovaFileTransfer。
所以我的问题是:我如何可以添加我的凭据知道需要验证上传和下载文件。
,这里是我使用的代码:
document.addEventListener('deviceready', function() {
var url = "https://serverlink/thing.txt";
var targetPath = cordova.file.externalRootDirectory + "/cloud/thing.txt";
var trustHosts = true;
var options = {
params: {
// Do i put my credentials here ??
}
};
console.log('before download');
$cordovaFileTransfer.download(url, targetPath, options, trustHosts)
.then(function(result) {
// Success!
console.log("done downloading the file");
}, function(err) {
// Error
console.log('error yaw !!', err);
}, function(progress) {
$timeout(function() {
$scope.downloadProgress = (progress.loaded/progress.total) * 100;
});
});
}, false);
所以,我测试上面这里我把我的凭据选项对象内部PARAMS的代码,但它不工作。