Ionic 2 - RC2.0, plugin for uploading file (transfer) wont't work


#1

Hello. The past 2 days i’ve spend struggling to make my app to upload the image taken with phone’s camera on a php server. The code on the server works just fine but the $_FILES var is empty. My problem is similar with the one described here, also without a solution https://stackoverflow.com/questions/40046639/corodova-file-transfer-not-working-after-updating-to-ionic-2-rc0.
My app connects to the camera, takes the picture, loads it and sends it to the server. The process takes a few seconds and that it. I recive no error on upload and yet the $_FILES[""] is empty.
I have tried several methods, includin using headers and removing headers but nothing worked. And the same probleme every time: no file uploaded on the server.

Technologies:
Cordova CLI: 6.1.1
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.4
Ionic App Lib Version: 2.1.2
Ionic App Scripts Version: 0.0.44
OS: Windows 7 SP1
Node Version: v6.2.0

Code:

Imports:

.......
import { Camera } from 'ionic-native';
import { Transfer } from 'ionic-native';
......

camera.html:

<button ion-button color="dark" (click)="takePhoto()">Open camera </button>
<img [src]="imageURL" *ngIf="imageURL" />
imageURL={{imageURL}}
<button ion-button color="dark" (click)="upload1()">Upload image</button>

camera.ts:

  takePhoto(){
    Camera.getPicture().then((imageData) => {
       this.imageURL = imageData;
    }, (err) => {
       console.log(err);
    });
  }

  upload1(){
            const ft = new Transfer();
            var options = {
                                                fileKey: 'file',
                                                fileName: 'file_name',
                                                headers: {
                                                           'Content-Type':'multipart/form-data'
                                                }
                                    }
ft.upload(this.imageURL,encodeURI("https://www.myserver........php?op=upload
"),options)

  .then((data) => {
            // success
                        alert("OK:"+this.imageURL);
            }, (err) => {
                        // error
                        alert("ERROR ON UPLOAD: "+err.toString()+"\n picture url: "+this.imageURL);  
            })
}

Thanks a lot.