[英]Cordova / PhoneGap Upload Error on Windows Phone 8.0
Hello everyone, I'm working with cordova 3.6.3 and Windows Phone 8.0 大家好,我正在使用Cordova 3.6.3和Windows Phone 8.0
I have a piece of code that works on Android 4 . 我有一段可在Android 4上运行的代码。 That code is for uploading an image to the server, using cordova-plugin-file-transfer (version 0.5.0) 该代码用于使用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);
},
In Windows Phone 8.0 I'm getting the error FileTransferError.FILE_NOT_FOUND_ERR (Code = 1) after upload method was called. 在Windows Phone 8.0中,调用上传方法后出现错误FileTransferError.FILE_NOT_FOUND_ERR (Code = 1)。
The path to the selected file for upload comes from navigator.camera.getPicture() method and is " x-wmapp0:/././//CaptureImagesCache/WP_20150213_003.jpg " 所选文件的上载路径来自navigator.camera.getPicture()方法,并且为“ x-wmapp0:/././/// CaptureImagesCache / WP_20150213_003.jpg ”
What is the correct path for accesing the image I want to upload? 访问我要上传的图像的正确路径是什么? That path should be the "fileURL" parameter of upload method (cordova-plugin-file-transfer) 该路径应为上传方法的“ fileURL”参数(cordova-plugin-file-transfer)
Thanks! 谢谢!
Gustavo 古斯塔沃
The trick is to replace "x-wmapp0:/./." 技巧是替换“ x-wmapp0:/./”。 with an empty string. 用空字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.