I am using Cordova FileTransfer plugin to upload image file in Amazon S3 server. Here is my procedure of performing fileTransfer
- 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
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)
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
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?
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.