|
navigator.camera.getPicture(onLoadImageLocalSuccess, onLoadImageFail, {
destinationType : Camera.DestinationType.FILE_URI,
sourceType : Camera.PictureSourceType.PHOTOLIBRARY
});
// 本地图片选择成功后回调此函数
function onLoadImageLocalSuccess(imageURI) {
// 此处执行文件上传的操作,上传成功后执行下面代码
var options = new FileUploadOptions(); // 文件参数选项
options.fileKey = "file";// 向服务端传递的file参数的parameter name
options.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1);// 文件名
options.mimeType = "image/jpeg";// 文件格式,默认为image/jpeg
var ft = new FileTransfer();// 文件上传类
// ft.onprogress = function(progressEvt) {// 显示上传进度条
// if (progressEvt.lengthComputable) {
// navigator.notification
// .progressValue(Math
// .round((progressEvt.loaded / progressEvt.total) * 100));
// }
// }
// navigator.notification.progressStart("提醒", "当前上传进度");
ft.upload(imageURI, encodeURI(config.ohturl
+ '?action=uploadOrderPictureInfo' + '&purchase_no='
+ purchase_no + '&empid=' + empid), function() {
// navigator.notification.progressStop();// 停止进度条
navigator.notification.alert("文件上传成功!", null, "提醒");
}, function() {
// navigator.notification.progressStop();// 停止进度条
navigator.notification.alert("文件上传失败!", null, "提醒");
}, options);
// 所有获取图片失败都回调此函数
function onLoadImageFail(message) {
navigator.notification.alert("选择失败,原因:" + message, null, "警告");
}
在安卓 apk 显示正常,ios中navigator.notification.progressStart 未定义,不识别。这是什么情况,求大神指教 |
|