Hi All,
I am struggling with this for few days. Picture upload works fine in ios. but not in android.
it’s a simple code. imported camera, file transfer.
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.5
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 1.0.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.2
Xcode version: Not installed
simple code: addimage is been called from button
addimage() {
this.plt.ready().then((readySource) => {
let options = {
quality: 50,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.CAMERA,
allowEdit: true,
encodingType: Camera.EncodingType.JPEG,
// popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false,
correctOrientation: true
};
this.getPicture(options);
})// end get pic from Camera
}
getPicture(options) {
Camera.getPicture(options).then((fileUrl) => {
this.buildOptions(fileUrl);
},
(err) => {
alert(err);
});
}
buildOptions(fileUrl:any) {
let srvrurl = "http://ihandi.com/imageuploads/upload.php"
const fileTransfer = new Transfer();
let options: any;
options = {
fileKey: “file”,
fileName: fileUrl.substr(fileUrl.lastIndexOf(’/’) + 1),
chunkedMode: false,
mimeType:“image/jpeg”
};
fileTransfer.upload(fileUrl, encodeURI(srvrurl), options)
.then((result: any) => {
let res = JSON.parse(result.response);
this.prdimage = res.url;
},(err) => {
alert('Inside error');
alert(JSON.stringify(err));
});
I am testing this in IONIC VIEW. Works fine in IOS. But not in android. Get a null object
{code:null,source:null,target:null,http_status:null, body:null exception:null}