Hi after deleting the function and added the code 'captureimage command();' , errors appear
please help me solve and check my application as i have to complete it by this wednesday 06-august-2014
Hi after deleting the function and added the code 'captureimage command();' , errors appear
please help me solve and check my application as i have to complete it by this wednesday 06-august-2014
Samantha,
Did you follow all steps from instruction Evgene had provided?
What exact errors do you get?
errors are shown in the screenshot above.
yes i followed the steps. this is my codes as shown in the screenshot:
function captureSuccess(mediaFiles) {
var i, len;
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
function win(r) {
alert("Code = " + r.responseCode);
alert("Response = " + r.response);
alert("Sent = " + r.bytesSent);
}
function fail(error) {
alert("An error has occurred: Code = " + error.code);
alert("upload error source " + error.source);
alert("upload error target " + error.target);
}
var fileURI = data.imageURI;
var headers = {
'X-Appery-Database-Id': 'XXXXXXXXXXXXXXXX',
'X-Appery-Session-Token': localStorage.getItem("userSessionToken")
};
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = fileURI.substr(fileURI.lastIndexOf('/') + 1);
options.mimeType = 'image/jpeg';
options.headers = headers;
var uri = encodeURI("https://api.appery.io/rest/1/db/files/" + options.fileName);
var ft = new FileTransfer();
ft.upload(fileURI, uri, win, fail, options);
}
}
Code: Select all
// Called if something bad happens.
//
function captureError(error) {
var msg = 'An error occurred during capture: ' + error.code;
navigator.notification.alert(msg, null, 'Uh oh!');
}
// A button will call this function
//
function captureImage() {
// Launch device camera application,
// allowing user to capture up to 2 images
navigator.device.capture.captureImage(captureSuccess, captureError, {limit: 2});
}
// Upload files to server
function uploadFile(mediaFile) {
var ft = new FileTransfer(),
path = mediaFile.fullPath,
name = mediaFile.name;
ft.upload(path,
"[url=http://my.domain.com/upload.php]http://my.domain.com/upload.php[/url]",
function(result) {
console.log('Upload success: ' + result.responseCode);
console.log(result.bytesSent + ' bytes sent');
},
function(error) {
console.log('Error uploading file ' + path + ': ' + error.code);
},
{ fileName: name });
}
captureimage command();
Hello!
Sorry, there is a typo in Evgene's reply. Instead precaptureimage command();/pre use precaptureImage();/pre
Click on the link in console to find out where is the error.
Hello!
It needs to be tested in installed on device app. It won't work in browser.
hi. i have tested it on an ipad
however, it allows me to take picture instead and not record the voice.
please assist thanks
Hello Lim,
Could you please show what did you do for recording audio (code, events)?