大家好,我正在使用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)
谢谢!
古斯塔沃