我面临从相机和画廊上传文件的问题。
从图库中选择几张图片时,我能够成功地将图片上传到 WCF 服务。因此,WCF 服务运行良好,上传文件的代码也运行良好,同样的代码也适用于模拟网络摄像头。
但是,当从图库中选择一些图像时,我收到 *错误代码 *
java.io.FileNotFoundException: http://www.foobar.com/sasas
JavaScript 代码
function selectImageFromCamera(){
var popover = new CameraPopoverOptions(300,300,100,100,Camera.PopoverArrowDirection.ARROW_ANY);
var options = { quality: 49, destinationType: Camera.DestinationType.FILE_URI,sourceType: Camera.PictureSourceType.CAMERA, popoverOptions : popover};
navigator.camera.getPicture(this.uploadPhoto, this.onFail, options);
}
function selectImageFromGallery(){
var popover = new CameraPopoverOptions(300,300,100,100,Camera.PopoverArrowDirection.ARROW_ANY);
var options = { quality: 49, destinationType: Camera.DestinationType.FILE_URI,sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY, popoverOptions : popover};
navigator.camera.getPicture(this.uploadPhoto, this.onFail, options);
}
function uploadPhoto(imageURI) {
var serverUrl = "http://www.foobar.com/safafa";
var image = document.getElementById("imgUpload");
image.style.display = "block";
image.src = imageURI;
var fileUploadOptions = new FileUploadOptions();
fileUploadOptions.fileKey="file";
fileUploadOptions.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);
fileUploadOptions.mimeType="image/png";
fileUploadOptions.chunkedMode=true;
var ft = new FileTransfer();
ft.upload(imageURI, serverUrl, this.win, this.fail, fileUploadOptions);
}
请帮助我确定我做错了什么。