1

I want to rename a image after it is captured, File name gets successfully changed when I take picture but am facing some issue 1.Am not able to view that image in gallery but when I access that folder via FileManger am able to view it. 2.When I retrieve Image from gallery File Rename fails... (Error Code 1)

am using Cordova 2.5.0

function onPhotoURISuccess(imageURI) {
console.log("imageURI"+imageURI);
window.resolveLocalFileSystemURI(imageURI, gotFileEntry, fsFail); 
var FullData = ord_key + ',' + fileURL;
var arr = FullData.split(",");
InsertIntoTableWithoutAlert(tablename, coloumnArr, arr);
var ImgTag = window.localStorage.getItem("ImgCount");
ImgTag = parseInt(ImgTag) + 1;
window.localStorage.setItem("ImgCount", ImgTag);
ImgTag = "#" + ImgTag;
var Image = $(ImgTag);
Image.css("display", "block");
Image.attr("src", fileURL);
}

function gotFileEntry(e) {
console.log("esss "+ e.fullPath);
var p = e.fullPath.substr(0, e.fullPath.lastIndexOf('/'));
console.log("psss "+p);
parentEntry = new DirectoryEntry(e.fullPath,p);
e.moveTo(parentEntry, "546sas.jpg", successa, fsFail); 
//e.remove(successb,removefail);
}

function removefail(error) { 
    alert("failed with error code: removefail" + error.code); 
}

function successb(f){
alert("Success");
}

function successa(f){
fileURL = f.toURL();
console.log("fileurl " + fileURL);
}

function fsFail(error){ 
alert("failed with error fsFail  " + error); 
}
Divesh Salian
  • 1,457
  • 17
  • 30

0 Answers0