【问题标题】:mp3 file upload with phonegap on Windows RT [ Unicode Mapping error ]在 Windows RT 上使用 phonegap 上传 mp3 文件 [Unicode 映射错误]
【发布时间】:2013-05-20 18:49:30
【问题描述】:

我使用 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 ?统一码?文件路径是这样的

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.

【问题讨论】:

    标签: javascript jquery windows-8 visual-studio-2012 cordova


    【解决方案1】:

    我通过使用 Ajax 发布并通过使用Formdata() 以数组的形式在该处提供服务器得到了答案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-29
      • 1970-01-01
      • 2017-04-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多