I've recently built a service to upload files directly to S3 with Cloudfront - SignedUrl using FileTransfer - Cordova. Everything looks fine, I get the following response:
{"BytesSent": -numOfBytes-, "responseCode": 200, "objectId":""}
but I can't access this file - can't read, change, download got failed. Probably the files are corrupted, Just weird. the upload code -
let uri = data['signed_request'];
const ft: TransferObject = this.transfer.create();
let options : FileUploadOptions = {
fileKey: "file",
fileName: fileName,
mimeType: self.settings[kind].type,
chunkedMode: false,
httpMethod: 'PUT',
headers: {
'Content-Type': self.settings[kind].type,
'X-Amz-Acl': 'public-read'
}
}
ft.onProgress = function(progressEvent) {
if (progressEvent.length) {
} else {
}
};
ft.upload(file, uri, options, true).then((data) => {
resolve(data['readURL']);
}).catch((err) => {
resolve("Could not upload file. => " + err);
});
What do you think could be wrong? - I can't see any reasonable reason and stuck on this for too long.. Thanks