Upload directly on S3 (putObject)
Hello,
I am currently trying to upload a video directly to S3 with a signed url retrieved just before ant the put object method. The video arrives on the S3 bucket concerned, however it arrives corrupted. Indeed when I open the file here is the beginning of its content.
--Boundary+FA062E4EAF6B2732
Content-Disposition: form-data; name="file"; filename="cpcp_video_A997CCE8.mp4"
Content-Type: application/octet-stream
We just released a new version this morning. Can you try it ?
it doesn't seem to work :'(
Here is the error message: The request signature we calculated does not match the signature you provided. Check your key and signing method
Now even adding requestMethod: PUT in the payload does not seem to change the send method which remains a POST. And if I change it in the hard code I'm in the same situation as with the previous version
Hello @rudyZanotti,
Are you latest version? Also try to remove the requestMethod from JS code.
Regards, Zafir.
Hello @zafirskthelifehacker
This is my package.json : "cordova-plugin-background-upload": "github:spoonconsulting/cordova-plugin-background-upload#4.0.0",
And package.json plugin : "name": "@spoonconsulting/cordova-plugin-background-upload", "version": "4.0.0",
I see that in the FileUploader.m (iOS) line 131 it says "POST" in hard while I want to do a PUT on my S3
Hello @rudyZanotti,
Make sure in your package.json, the config is like this:
"@spoonconsulting/cordova-plugin-background-upload": "4.0.0"
And yes, we don't have requestMethod in the payload, try to modify FileUploader.m to cater for PUT method.
Regards, Zafir.
Yes i have the latest version.
Even if I change FileUploader.m to use the PUT method, I get the same result as my first post (beginning of issue)
Hello @rudyZanotti,
Try to include "Content-Decomposition": "............." in your headers.
Also you should check this guide as I think you might have to use Multipart uploads on S3: https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html
Regards, Zafir.
Made a Fork here: https://www.npmjs.com/package/cordova-plugin-background-upload-put-s3
Hello @maxcodefaster,
Can you do a PR on this repository? We will review and merge it here. Also you can make pass the method request as a parameter so that it is configurable.
Regards, Zafir