Cordova Phone Gap文件传输插件上载问题
我在phonegap文件传输上载中遇到本机代码错误: 无法读取未定义的属性上载 我正在visual studio 2013中使用Apache cordova模板 这是我的js代码Cordova Phone Gap文件传输插件上载问题,cordova,Cordova,我在phonegap文件传输上载中遇到本机代码错误: 无法读取未定义的属性上载 我正在visual studio 2013中使用Apache cordova模板 这是我的js代码 function getPhoto(source) { // Retrieve image file location from specified source navigator.camera.getPicture(onPhotoURISuccess, onFail, { quali
function getPhoto(source) {
// Retrieve image file location from specified source
navigator.camera.getPicture(onPhotoURISuccess, onFail, {
quality: 50,
destinationType: destinationType.FILE_URI,
sourceType: source
});
}
function onPhotoURISuccess(imageURI) {
// Uncomment to view the image file URI
// console.log(imageURI);
alert("Imagecalled");
// Get image handle
//
var largeImage = document.getElementById('largeImage');
// Unhide image elements
//
largeImage.style.display = 'block';
// Show the captured photo
// The inline CSS rules are used to resize the image
//
largeImage.src = imageURI;
uploadPhoto(imageURI);
}
function uploadPhoto(imageURI) {
alert("uploadPhoto");
debugger;
var objUrl = _ServicesUrl._SecondServicePath + _ServicePage._BaseServicePage + _WcfFunctionUrl._ImageUpload;
var serverUrl = objUrl;
//var fileUploadOptions = new FileUploadOptions();
//fileUploadOptions.fileKey = "file";
//fileUploadOptions.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1);
//fileUploadOptions.mimeType = "image/jpeg";
//fileUploadOptions.chunkedMode = true;
//var ft = new FileTransfer();
//ft.upload(imageURI, serverUrl, this.win, this.fail, fileUploadOptions);
var options = new FileUploadOptions();
options.chunkedMode = false;
options.fileKey = "recFile";
var imagefilename = imageURI;
options.fileName = imagefilename;
options.mimeType = "image/jpeg";
var ft = new FileTransfer();
alert(imagefilename);
ft.upload(imageURI, serverUrl, win1, fail1, options);
}
插件不能在ripple上工作。它们执行本机代码。您应该尝试使用实际的仿真器。感谢Michael的帮助,当我尝试使用Android Phone时,它正在工作。是否有人知道如何在wcf服务上处理多部分表单数据。您应该在一个新问题中问这个问题。