【发布时间】:2015-04-14 17:19:14
【问题描述】:
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” p>
问题
访问我要上传的图片的正确路径是什么?该路径应该是上传方法的“fileURL”参数(cordova-plugin-file-transfer)
谢谢!
古斯塔沃
【问题讨论】:
标签: cordova windows-phone-8 windows-phone image-uploading file-transfer