gpt4 book ai didi

cordova.file.dataDirectory 不在应用程序文件夹内创建文件

转载 作者:行者123 更新时间:2023-12-02 20:53:11 25 4
gpt4 key购买 nike

使用cordova.file将图像下载到dataDirectory中。我正在将文件保存到内部应用程序文件夹中。在模拟器中我可以看到下载的文件,但在真实设备上我无法看到下载的文件。这是我的路径看起来像

enter image description here无法在应用程序文件夹中看到此图像。

$scope.Download = function () {
var FileURL = appService.downloadFiles($scope.selectedFile.FileKey);
var targetPath = cordova.file.dataDirectory + "ChatApp/" + $scope.selectedFile.FileName;
var trustHosts = true;
var options = {};
$cordovaFileTransfer.download(FileURL, targetPath, options, trustHosts)
.then(function (result) {
alert('file downloaded successfully');
console.log(result);
refreshMedia.refresh(targetPath);
}, function (err) {
console.log(err);
}, function (progress) {
console.log(progress);
});

};
}

cordova.file.dataDirectory中创建文件夹是否需要任何权限。我如何在内部应用程序文件夹中看到此文件。

最佳答案

您正在使用cordova.file.dataDirectory。在真实设备中,您无法使用文件管理器/第三方应用程序访问此文件夹。这是出于安全原因。如果您想查看下载的文件,请使用 cordova.file.externalDataDirectory 而不是 cordova.file.dataDirectory 。然后您可以在内存中的应用程序文件夹中看到该文件。

关于cordova.file.dataDirectory 不在应用程序文件夹内创建文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41458966/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com