Response empty while uploading files to Amazon S3 using Cordova FileTransfer?

I am using Cordova FileTransfer plugin to upload image file in Amazon S3 server. Here is my procedure of performing fileTransfer

  1. I called my server with the photoURL and get the keys for submitting amazon s3 server which I included as key value pair in params
  2. Then I am using the fileTransfer plugin for uploading the file with following codes.

        var options = new FileUploadOptions();
        options.fileKey = "file";
        options.fileName = fileName;
        options.mimeType = "image/jpeg";
        options.chunkedMode = false;
        options.encodeURI= false;
    
        var headers={
            'X-Amz-Acl': 'public-read'
        };
    
        options.headers = headers;
        options.params = params;
    
        var ft = new FileTransfer();
        ft.upload(fileURL,form.action, win, fail, options) 
    
  3. The response returns to the win function returning json response

        bytesSent: 31968
        objectId: ""
        response: ""
        responseCode: 204
    

    The file is not uploaded and I am not getting any response URL of my image

  4. I have used 'Content-Type': 'image/jpeg' But its responding 412 error code and in Message Bucket POST must be of the enclosure-type multipart/form-data. Why this is the response as I am sending speically to use image/jpeg content type?

  5. Here I followed this answer By pull method. But It return in fails fuction. I get error code 3 which say MalformedXML in body and error saying "Write error: ssl=0x6d3c2c20: I/O error during system call, Connection reset by peer"

Please someone help me to get what I am missing here. Thanks in advance.

Answers


Yes. For android the response is null returned but for iOS response is okay.

So for android the work around will be the

response = form.action + params.key;

And following code are enough for sending the file( 4, 5 points are ignored )

var options = new FileUploadOptions();
        options.fileKey = "file";
        options.fileName = fileName;
        options.chunkedMode = false;

        options.params = params;

Need Your Help

How to customize form styled by django-uni-form?

html css django django-forms

I'm using django-uni-form to style my form using the filter my_form|as_uni_form:

Java program can not find a file that's been just created in a shell script

java file shell echo output

I am running a shell script from Java program and in that shell script I am echoing its output to a text file, and in the same Java program I am trying to read that newly created text file. However...