mardi 6 octobre 2015

Phonegap Not able to upload audio after capturing

<!DOCTYPE html>
<html>
  <head>
    <title>Capture Audio</title>

    <script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Called when capture operation is finished
    //
    function captureSuccess(mediaFiles) {
        var i, len;
        for (i = 0, len = mediaFiles.length; i < len; i += 1) {
            uploadFile(mediaFiles[i]);
        }
    }

    // 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 captureAudio() {
        // Launch device audio recording application,
        // allowing user to capture up to 2 audio clips
        navigator.device.capture.captureAudio(captureSuccess, captureError, {limit: 2});
    }

    // Upload files to server
    function uploadFile(mediaFile) {
        var ft = new FileTransfer(),
            path = mediaFile.fullPath,
            name = mediaFile.name;

        ft.upload(path,
            "http://ift.tt/1QX3PP9",
            function(result) {
                alert(result.responseCode);
                alert(result.bytesSent);
            },
            function(error) {
                alert("Error"+error.code);
            },
            { fileName: name });
    }

    </script>
    </head>
    <body>
        <button onclick="captureAudio();">Capture Audio</button> <br>
    </body>
</html>

Above is my code where i am capturing an audio clip and want to upload in file which is already created in www directory of wamp server but i am unable to upload it .
It gives following error

10-06 23:30:28.386: I/Database(638): sqlite returned: error code = 14, msg = cannot open file at source line 25467
10-06 23:30:48.785: D/FileTransfer(638): fileKey: file
10-06 23:30:48.865: D/FileTransfer(638): fileName: recording20861.3gpp
10-06 23:30:48.865: D/FileTransfer(638): mimeType: image/jpeg
10-06 23:30:48.875: D/FileTransfer(638): params: {}
10-06 23:30:48.875: D/FileTransfer(638): trustEveryone: false
10-06 23:30:48.885: D/FileTransfer(638): chunkedMode: true
Please help me out :(

Aucun commentaire:

Enregistrer un commentaire