How to send Image to the server of a Phonegap Mobile app with PHP?

0

I have a hybrid, functional application using Phonegap. My problem now is to send the image obtained from within the app to an external server.

This is the code for capturing image using a Cordova plugin.

capturePhoto: function(){

    navigator.camera.getPicture(onSuccess, onFail, { 
        quality: 50,
        destinationType: Camera.DestinationType.DATA_URL,
        correctOrientation: true,
        saveToPhotoAlbum: true 
    });

    function onSuccess(imageData) {
        $.post( "http://www.exemplo.com/api/upload.php", {data: imageData}, function(data) {
            alert("Image uploaded!"+ data);
        });
    }

    function onFail(message) {
        alert('Failed because: ' + message);
    }
}
    
asked by anonymous 04.05.2018 / 01:45

0 answers