簡體   English   中英

在Windows RT上使用phonegap上傳mp3文件[Unicode映射錯誤]

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

我使用phogap功能錄制音頻並上傳音頻,文件。 音頻文件正在錄制並存儲在音樂文件夾中,我通過以下功能獲取文件的路徑和名稱。

 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);
        }   

我調用該函數以上傳創建的音頻文件。

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);
        }

但是在運行時,出現這些錯誤,被卡住了,該錯誤是URL還是PATH? Unicode? 文件的路徑是這樣的

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()來獲取數組形式的服務器來獲得答案。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM