Upload formData with S3 pre-signed URL
See original GitHub issueHello, first, here is the versions I’m using :
"react": "16.9.0",
"react-native": "0.61.5",
"rn-fetch-blob": "^0.12.0"
I’m trying to upload a file using S3 and pre signed URL. I’m using rn-fetch-blob like this :
RNFetchBlob.fetch('POST', url, {
'Content-Type' : 'multipart/form-data',
}, [
{
name : name,
filename: file.fileName,
data: formData(fields)}
]).then((resp) => {
console.log(resp);
}).catch((err) => {
// ...
console.log("Catch error", err);
})
where formData is basically a function returning a FormData() object containing all needed informations for S3 key, region, bucket, ....
and the url
is the pre signed URL for S3 upload. However, by doing this, I’m getting a black screen, so I just wanted to know, if S3 upload (with pre signed method) was possible to achieve using rn-fetch-blob
?
Any ideas, help, is very welcome. Thanks !
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Upload files to AWS S3 using pre-signed POST data ... - Webiny
Start your serverless journey by learning how to upload files directly to S3 using pre-signed POST data and a simple Lambda function.
Read more >Uploading formData file from client to S3 using ...
I've tried: Both getPresignedUrl & createPresignedPost to generate the url; Both PUT & POST requests; Setting headers ( Content ...
Read more >Multipart uploads with S3 pre-signed URLs | Altostra
Upload the object's parts. Complete multipart upload. For that to work with pre-signed URLs, we should add one more stage: generating pre-signed ...
Read more >S3 direct file upload using presigned URL from React and Rails
In this post we'll discuss how to upload a file directly on Amazon S3 using presigned URL from React and Ruby on Rails...
Read more >AWS S3 Presigned Post upload in JavaScript with FormData
result of presigned post Aws::S3::Bucket.presigned_post API call. type TokenT = {. url: ?string,. fields: Map<string, any>,. };. // file is a web api...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@matamicen This code works for both Android & iOS
Note 1.
{ 'Content-Type': undefined }
is needed for iOS (works with Android) 2.file.path.replace('file://', '')
is also needed for iOS (works with Android)Hi @manilbajracharya @siriwatknp This is how I’ve implemented it:
This throws no error in the console, but when I paste the signed url in the browser, this is what I see:
<Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
RN version: 0.63.4 OS: Android Library version: ^0.12.0
Could you please let me know where I might be making a mistake? Thank you.