Hi
I need help to transfer a video from my app to an external server.
I can record the video using this code:
code
var captureSuccess = function(mediaFiles) {
var i, path, len;
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
path = mediaFiles.fullPath;
Appery("labelVideoUrl").text(path);
// do something interesting with the file
}
};
// capture error callback
var captureError = function(error) {
navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error');
};
// start video capture
navigator.device.capture.captureVideo(captureSuccess, captureError, {duration:100});
/code
After registration I get this string
code
/private/var/mobile/Applications/9B7726E0-ADF5-4D65-A2AF-EDDCAA282306/tmp/capture-T0x16e0dc20.tmp.NBvYID/capturedvideo.MOV
/code
after i invoke a javascript function like this:
code
// Upload files to server
function uploadFile(mediaFile) {
var ft = new FileTransfer(),
path = mediaFile.fullPath,
name = mediaFile.name;
Code: Select all
ft.upload(path,
"http://my.domain.com/upload.php",
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 });
} /code
where am I doing wrong?
Thanks
Diego