I have a working app that takes picture but I want to copy or move the picture from the cache folder to an other folder.I can't do it work, it returns me the error [object Object].
Regards
function copiePhoto() {
try {
var fail = function (err) {
alert(err);
};
window.resolveLocalFileSystemURI("file:///storage/emulated/0/Android/data/com.coolappz.capigo/cache/1427968060754.jpg", function (file) {
window.resolveLocalFileSystemURI("file:///test", function (destination) {
file.moveTo(destination, "test.jpg");
}, fail);
}, fail);
} catch (err) {
alert("copie : " + err);
}
}
After some hours of work I did it works :
function recupImage(imageURI) {
window.resolveLocalFileSystemURI(imageURI, copiePhoto, fail);
}
function copiePhoto(fileEntry) {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys) {
fileSys.root.getDirectory("photos2", {create: true, exclusive: false}, function(dir) {
fileEntry.copyTo(dir, fileEntry.name, onCopySuccess, fail);
}, fail);
}, fail);
}
function onCopySuccess(entry) {
alert('image copié dans le chemin : ' + entry.fullPath);
}
function fail(error) {
alert(error.code);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With