Picture upload does not work in android

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}

Happening to me too. How about it, Ionic? Or is the point of this forum just “dumping ground that we hope will be mistaken for customer support”?

That’s the great thing about his forum. It’s absolutely useless.

Hi Guys & Ionic,

Please help if anybody have encountered & resolved this issue. because this is critical functionality for our project. if we can’t resolve this in next day or two. then we might need to move back to IONIC1. I quickly tested this IONIC1 and it is working absolutely fine.

Thanks in adavance.

@kylemax, Did you make any progress on this issue? , Thanks

Having the same issue as well. I will file an issue.

Thanks Brad. I still could not get this thing working. Please do post me if you make any progress. I’ll do the same.
Thanks again

@BradHoffman96, Good news. Android picture upload is working if we build APK. it’s just not working in IONIC VIEW. so I think we are good to to.

@rajugvb What do you mean after you build the APK? Can you provide specific instructions as to how you fixed this?

Thank you.

  • Brad

Fix is documented here, if you looked at the ionic view issues github…

https://github.com/driftyco/ionic-view-issues/issues/192