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的代碼,但它不工作。