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

时间:2015-04-14 17:19:14

标签: cordova windows-phone-8 windows-phone image-uploading file-transfer

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

简介

大家好,我正在使用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 "

问题

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

谢谢!
古斯塔沃

0 个答案:

没有答案