How to create android cordova image upload with another input form

Viewed 398

I'm setting up a new application using Cordova and framework7, and I want to create a form containing photo/image-from-camera and input form as description and name-file.

I have successfully call camera function to take a picture from android phone, but I need to send image temporary location from phone to input value and submit form.

So where do I start to submit form with image data, name and description when I clicked submit button.

1 Answers

Try this

navigator.camera.getPicture(cameraSuccess, cameraError);

// success
function cameraSuccess(file_uri) {
  window.resolveLocalFileSystemURL(file_uri,
    function(fileEntry) {
        // fileEntry will have file name and file native URL
    });
}

// error
function cameraError(imageData) {
  // on error
}

Make sure camera destinationType is set to FILE_URI

Related