Uploading camera image to a REST service
I need to upload images to an Alfresco based server repository.
This is the HTML code that is working properly on a browser:
It is not so clear for me what type of data is storing the Appery previewImage object and how to post it.
Could you help me to write the correct JS code to upload the camera image?
This is the lastly try that i have done, but it is not working:
// scannedImage is the appery previewImage object
// where i saved the smartphone camera image
var data = new FormData();
var content = localStorage.getItem('scannedImage'); // the image
alert(content);
data.append("image", content);
$.ajax({
url: 'https://myserver.it/myapp/upload?uplo...,
data: data,
cache: false,
contentType: false,
processData: false,
type: 'POST',
}).done(function( msg ) {
alert( "File caricato: " + msg );
}).fail(function(failure){
alert("Errore nel caricamento:" + failure);
});
return false;