0
私はphonegapアプリで自分のAndroid携帯にファイルをダウンロードしようとしています。しかし、私はいつもアップロードエラーコード3を取得します。私はそれを明確にするためにすべてのデータをダンプしようとしました。phonegapでFileTransferエラーコード3をダウンロードする方法を教えてください。
は私のconfig.xmlに追加:
<access origin="http://example.com/" />
index.js:
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, fail);
function onFileSystemSuccess(fileSystem) {
alert("FileSystem : " + fileSystem.name); // FileSystem : persistent
var rootDeviceUrl = fileSystem.root.toURL();
alert("Root device Url : " + rootDeviceUrl); // Root device Url : file:///storage/emulated/0/
var downloadURL = 'http://example.com';
new FileTransfer().download(downloadURL,
rootDeviceUrl,
function(entry) {
alert("download complete: " + entry.fullPath);
},
function(error) {
alert("download error source " + error.source); // download error source http://example.com
alert("download error target " + error.target); // download error target file:///storage/emulated/0/
alert("upload error code " + error.code); //upload error code 3
});
}
function fail(error) {
alert("Error : " + error.code);
}
代わりにリクエストファイルシステムのURLを使用する必要があります。この作業サンプルをチェックしてください - https://github.com/gandhirajan/Cordova_File_Operationsは私が答えとして投稿できるように助けてくれるかどうかを教えてくれます。歓声 – Gandhi
私の元のコードから何行のコードを変更する必要がありますか? –
私はfilesystemをfilesystemurlに変更する必要があると述べました。 – Gandhi