Cordova / PhoneGap 在 Windows Phone 8.0 上上传错误



Cordova/PhoneGap 在 Windows Phone 8.0 上上传错误

介绍

大家好,我正在使用cordova 3.6.3和Windows Phone 8.0
我有一段适用于Android 4的代码。该代码用于使用 cordova-plugin-file-transfer(版本 0.5.0)
将图像上传到服务器

法典

var options = new FileUploadOptions();
options.fileKey = "newCommentMailForm";
options.fileName = attachedImage.FileName;
options.chunkedMode = true;
var params = {};
params.imageUid = attachedImage.ImageUid;
options.params = params;
var fileTransfer = new FileTransfer();
fileTransfer.upload(
  attachedImage.ImageURI,
  encodeURI(WEBAPI_SERVER + "/api/upload"),
  function (fileUploadResult) {
    app.onSendImageSuccess(fileUploadResult, attachedImage);
  },
  app.onSendImageFail,
  options,
  true); 
onSendImageSuccess: function (fileUploadResult, attachedImage) {
// success
},
onSendImageFail: function (fileTransferError) {
    Log("Code = " + fileTransferError.code);
    Log("Source " + fileTransferError.source);
    Log("Target " + fileTransferError.target);
},

错误

在Windows Phone 8.0中,调用上传方法后,我收到错误FileTransferError.FILE_NOT_FOUND_ERR(代码= 1)。

要上传的选定文件的路径来自navigator.camera.getPicture()方法,为"x-wmapp0:/././//CaptureImagesCache/WP_20150213_003.jpg"

问题

访问我要上传的图片的正确路径是什么?该路径应该是上传方法(cordova-plugin-file-transfer)的"fileURL"参数

谢谢!
古斯塔沃

诀窍是将"x-wmapp0:/./."替换为空字符串。

相关内容

最新更新