service execute parameters
Hi,
I am trying to invoke a service from javascript.
service URL is {database_url}/files/{file_name}
Code to invoke:
function takePhoto2() {
// Retrieve image file location from specified source
navigator.camera.getPicture(uploadPhoto2,
Code: Select all
function(message) {
alert('get picture failed');
}, {
quality: 50,
destinationType: navigator.camera.DestinationType.DATA_URL,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
});
}
function uploadPhoto2(dataURL) {
var binaryData = dataURL;
Code: Select all
svcUploadImage2.execute({
headers: {
"X-Appery-Database-Id": '...',
"X-Appery-Session-Token": localStorage.getItem("userSessionToken"),
"Content-Type": 'image/jpeg'
},
data: dataURL
});
}
The service was successfully run and I see a file in the files database, but the content of file is different from the dataURL, and the file in the database is not in proper jpeg format.
The file in files database has content like
0=i&1=m&2=a&3=g&4=e&5=%2F&6=j&7=p&8=e&9=g&10=%3B&11=b&12=a&13=s&14=e&15=6&16=4&17=%2C&18=%2F&19=9&20=j&21=...
but the value of dataURL is very different.
Any clue what can be done to upload dataURL exactly?
Thanks