저는 Cordova 3.6.3을 사용 중이므로 Android에서 파일을 다운로드하고 싶습니다. 파일 및 파일 전송에 대한 모든 권한을 추가하고 파일 및 파일 전송 플러그인도 추가합니다. 그게 내게 줄 오류 코드 : 1 .its 메모리에 파일을 만들 수 있지만 그 유일한 이름. 그것은 비어 있습니다. 문제가 무엇입니까?Cordova 3.6.3 Android에서 파일 다운로드
다른 해결책을 찾아 보지만 작동하지 않습니다.
var resimURL= "https://farm"+url.farm+".staticflickr.com/"+url.server+"/"+url.id+"_"+url.secret+"_b.jpg";
//alert("Download");
alert(resimURL);
var remoteFile =resimURL;
var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
function(fileSystem) {
fileSystem.root.getFile(localFileName, {create: true, exclusive: false},
function(fileEntry) {
var localPath = fileEntry.fullPath;
alert(localPath);
if (device.platform === "Android" && localPath.indexOf("file://") === 0) {
localPath =fileSystem.root.toUrl()+localPath.substring(7);
alert(localPath);
}
var ft = new FileTransfer();
ft.download(remoteFile, localPath,
function(entry) {
alert("Download Complete");
},
fail);
},
fail);
},
fail);
function fail(error) {
alert("error"+error.code);
}
작업 나는 그것을하지만 그나마 좀 도와했다. :) 같은 오류. –
@ NazırDogan 음 ... 오류 코드 1은 FILE_NOT_FOUND_ERR입니다. 브라우저에서 파일을 다운로드 할 때 다운로드 URL이 제대로 다운로드됩니까? – SLee
예. 내 앱에서이 링크를 다운로드하는 경우 (예 : https://farm4.staticflickr.com/3950/14951861574_27472abe70_b.jpg –