Uploading image to server not working on android versions below lollipop

I have created an android application with ionic framework using angularjs and have implemented camera plugin from ngCordova(version 5.0.0) into my app.
I want to capture image from camera and upload it to server.I m calling api for that. In dataURItoBlob() function i have used BLOB() and BlobBuilder if BLOB is not supportable.It is working fine for lollipop. For lollipop I am getting alert
"inside try bb: [object Blob]"
and image is getting uploaded properly.
but for versions below lollipop, When I am capturing image and uploading it to server, then it goes inside catch() and i got
"inside catch cc: [object Blob]"
in my alert But if I check on server side, size of that uploaded image is 0(zero) for versions below lollipop.Image captured from camera is getting displayed in #Selectedimage DOM element(img tag) on all versions of android.
What can be the issue?

this is my dataURItoBlob() code

   function dataURItoBlob(dataURI) 

     var byteString;
     if (dataURI.split(',')[0].indexOf('base64') >= 0)
               byteString = atob(dataURI.split(',')[1]);
               byteString = unescape(dataURI.split(',')[1]);
    alert("bytestring: "+byteString)
           // separate out the mime component
    var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
    alert("minestring: "+mimeString)
           // write the bytes of the string to a typed array
    var ia = new Uint8Array(byteString.length);
    alert("ia: "+ia[0] + " " + ia[1]+ " "+ ia[2]+ " "+ ia[3]);
    for (var i = 0; i < byteString.length; i++) {
               ia[i] = byteString.charCodeAt(i);
    alert("ia: "+ia[0] + " " + ia[1]+ " "+ ia[2]+ " "+ ia[3]);
    try {
               var bb = new Blob([ia], mimeString);
               alert("inside try bb: "+bb);
               return bb;
      } catch (e) {
               var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder
               var bb = new BlobBuilder();
               var cc = bb.getBlob(mimeString);
               alert("inside catch cc: "+cc);
               return cc;

my take picture code

    $scope.getPhoto = function () 
        var options = { 
            quality : 75, 
            destinationType : Camera.DestinationType.DATA_URL, 
            sourceType : Camera.PictureSourceType.CAMERA, 
            allowEdit : true,
            encodingType: Camera.EncodingType.JPEG,
            targetWidth: 300,
            targetHeight: 300,
            popoverOptions: CameraPopoverOptions,
            saveToPhotoAlbum: false

        $cordovaCamera.getPicture(options).then(function (imageData) {
        $('#Selectedimage').attr('src', "data:image/jpeg;base64,"+imageData);
        $scope.fileUpload = dataURItoBlob("data:image/jpeg;base64,"+imageData);
        }, function (err) {
            alert("An error occured: " + err);