html - PhoneGap: Upload captured video to server -


i have created phonegap app capture video , upload server. have tried sample code below:

<!doctype html> <html>   <head>     <title>capture video</title>      <script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>     <script type="text/javascript" charset="utf-8" src="json2.js"></script>     <script type="text/javascript" charset="utf-8">      // called when capture operation finished     //     function capturesuccess(mediafiles) {         var i, len;         (i = 0, len = mediafiles.length; < len; += 1) {             uploadfile(mediafiles[i]);         }     }      // called if bad happens.     //     function captureerror(error) {         var msg = 'an error occurred during capture: ' + error.code;         navigator.notification.alert(msg, null, 'uh oh!');     }      // button call function     //     function capturevideo() {         // launch device video recording application,         // allowing user capture 2 video clips         navigator.device.capture.capturevideo(capturesuccess, captureerror, {limit: 2});     }      // upload files server     function uploadfile(mediafile) {         var ft = new filetransfer(),             path = mediafile.fullpath,             name = mediafile.name;          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 });     }      </script>     </head>     <body>         <button onclick="capturevideo();">capture video</button> <br>     </body> </html> 

it can capture video normally, however, when calling upload function, got "mediafile.fullpath undefined" , stopped working. have idea how solve problem?


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -