How to get a picture from the phone book to remote XPage?

I created a Phonegap app with version 1.6 on my iPad ulr suite for XPage on a Domino server

now to my problem:

When I take a picture on the iPhone and upload it to my XPage using the function takePicture, "returnvalue" is a string like this

data:image/jpeg;base64,file://localhost/var/mobile/Applications/C1ABCAD3-5F54-45AB-81B0-A242940B58CB/tmp/photo_001.jpg

is it possible to upload a file, not a line?

here is the code i use:

XSP.submitLatency = 300*1000;

function takePicture() {    
    navigator.camera.getPicture(displayPicture,
     showError,
      { quality: 50 }

      ); 

}

function displayPicture(data) {

alert("Hallo" );
    var imagePanel = document.getElementById('imagePanel');
    imagePanel.style.display = "";
    imagePanel.style.position = "absolute";
    imagePanel.style.top = "250px";
    imagePanel.style.left = "0px";




    alert("data:image/jpeg;base64," + data)
    document.getElementById('image').src = "data:image/jpeg;base64," + data;
    document.getElementById("#{javascript:getClientId('inputHidden1')}").value = "data:image/jpeg;base64," + data;

    document.getElementById("#{javascript:getClientId('button1')}").disabled = false;
}

function showError(fail) {
    alert(fail);
}
+3
source share
1 answer

What you want to do is ask the getPicture method to return FILE_URI instead of DATA_URL, specifying the target type as part of options . Once you have a URI, you can use FileTransfer.upload to download the file.

+1
source

All Articles