简体   繁体   中英

mp3 file upload with phonegap on Windows RT [ Unicode Mapping error ]

I used phogap function for recording audio and uploading audio , file. Audio File is recording and stored in music folder and I get the path and name of the file by the below function.

 function captureSuccess(mediaFiles) {
            var i, len;
            for (i = 0, len = mediaFiles.length; i < len; i += 1) {
                uploadFile(mediaFiles[i]);
            }
            alert('over');
        }
        function captureAudio() {
            navigator.device.capture.captureAudio(captureSuccess, captureError, { limit: 1, duration: 10 });

        }
        function uploadFile(mediaFile) {
            var ft = new FileTransfer(),
                path = mediaFile.fullPath,
                name = mediaFile.name;
            temp = path;  //Assigned path to GLOBAL VARIABLE
            temp1 = name;
            alert(temp);
        }   

I call the function to upload the created audio file.

function uplod() {
            var options = new FileUploadOptions();
            options.fileKey = "file";
            options.fileName = name;
            options.mimeType = "audio/mpeg";
            options.chunkedMode = false;

            var ft = new FileTransfer();
            ft.upload(temp,
                      "http:/URL/upload.php",
                      function (result) {
                          alert("success" + result.bytesSent + result.responseCode);
                          console.log('Upload success: ' + result.responseCode);
                          console.log(result.bytesSent + ' bytes sent');
                      },
                      function (error) {
                          console.log('Error uploading file ' + recordingPath + ': ' + error.code);
                      },
                      options);
        }

But on running, I get these error, got stucked up, is the error is with URL or PATH ? Unicode ? and path of file is like this

C:/Users/AB/Music/captureAudio (4).mp3

 0x80070459 - JavaScript runtime error: No mapping for the Unicode character exists in the target multi-byte code page.

WinRT information: No mapping for the Unicode character exists in the target multi-byte code page.

我通过使用Ajax post并通过使用Formdata()来获取数组形式的服务器来获得答案。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM