0
私は写真を手に入れています。私はそれらを見せたいと思うので、私のディレクトリに保存してください。私はこのフォーラムとw3cからの複合的な回答に続き、このコードを入手しました。私の問題は、私がfileSysディレクトリを取得したとき、onErrorに行き、myFolderAppディレクトリを取得できなくなったときです。 /storage/sdcard1/Android/data/tta.kirolapp.v1/filesエラー5写真をコルドバのアプリで撮るときにディレクトリを取得する
と
ディレクトリを確保するために失敗しました:: モニターは
は、ディレクトリを確保するために失敗しました」と表示します/storage/sdcard1/Android/data/tta.kirolapp.v1/filesこれは正常ですオールトディレクトリがそう
/storage/emulated/0/0Android/data/tta.kirolapp.v1/
ですが、私はこれが問題だと思うが、私はそれを修正する方法がわかりません。 写真を撮影し、それを管理する機能のコード、次です:
function capturePhoto() { alert('on capturePhoto'); sessionStorage.removeItem('imagepath'); //Cogemos la imagen y la codificamos en Base64 navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50, cameraDirection: 1, saveToPhotoAlbum:true, destinationType: Camera.DestinationType.FILE_URI }); } function onPhotoDataSuccess(imageURI) { // Uncomment to view the base64 encoded image data // console.log(imageData); // Get image handle // var imgProfile = document.getElementById('fotoRegistro'); // Pasamos la imagen a pantalla desde imageURI // console.log('El url por defecto es: '+ imageURI); imgProfile.src = imageURI; if(sessionStorage.isprofileimage==1){ getLocation(); } movePic(imageURI); } // Funcion onError // function onFail(message) { alert('Failed because: ' + message); } function movePic(file){ window.resolveLocalFileSystemURL(file, resolveOnSuccess, resOnError); } //Callback function when the file system uri has been resolved function resolveOnSuccess(entry){ console.log("Estoy en resolveOnSuccess"); var d = new Date(); var n = d.getTime(); //new file name var identificacion= $('#idEmailReg').val(); var newFileName="foto"+identificacion+".jpg"; console.log ('El newFileName es: '+ newFileName); var myFolderApp = "file:///storage/emulated/0/Android/data/tta.kirolapp.v1/img/"; //appConstants.localPermanentStorageFolderImg; console.log ('El nuevo directorio es: '+ myFolderApp); window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys) { console.log ('Entramos en el request onSuccess'); //The folder is created if doesn't exist fileSys.root.getDirectory(myFolderApp, {create:true, exclusive: false}, function(directory) { console.log('El directory es: '+ directory); entry.moveTo(directory, newFileName, successMove, resOnError); }, resOnError); }, resOnError); } //Callback function when the file has been moved successfully - inserting the complete path function successMove(entry) { //Store imagepath in session for future use // like to store it in database sessionStorage.setItem('imagepath', entry.fullPath); } function resOnError(error) { alert(error.code); }