How to do PUT request with FileTransfer


I’m developing an application in Ionic 2 and I’m trying to send to the backend the dataUser object that contains fields like first_name and last_name and more the image of the user selected from the device gallery thanks to ImagePicker.
To use FileTransfer to make the PUT of the user image and the various user data I do

const fileTransfer: TransferObject = this.transfer.create();
imageLocation = this.avatar[0];

let options: FileUploadOptions = {
        fileKey: 'avatar',
        httpMethod: 'PUT',
        headers: { 'Authorization': 'JWT ' + this.token },
        params: this.dataUser
fileTransfer.upload(imageLocation, encodeURI('http://ENDPOINT'), options, true)
            .then((data) => {
                console.log('put request success -> ' + data);                 
             }, error => {

The problem is that when I run the upload method, the PUT is successful because I print to the console the message “put request success ->”, but the data value is undefined.
From the backend log I see that a PUT request has arrived but actually does not upload any data.
some ideas?


I wonder if using an https endpoint would have any effect.


Are you saying to replace http with https?


I’m saying it’s worth a try. iOS in particular seems to be concerned with sending data to non-secure endpoints.