簡體   English   中英

Windows Phone 8.0上的Cordova / PhoneGap上傳錯誤

[英]Cordova / PhoneGap Upload Error on Windows Phone 8.0

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 (Code = 1)。

所選文件的上載路徑來自navigator.camera.getPicture()方法,並且為“ x-wmapp0:/././/// CaptureImagesCache / WP_20150213_003.jpg

訪問我要上傳的圖像的正確路徑是什么? 該路徑應為上傳方法的“ fileURL”參數(cordova-plugin-file-transfer)

謝謝!
古斯塔沃

技巧是替換“ x-wmapp0:/./”。 用空字符串。

暫無
暫無

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

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