Comments (5)
I'm not sure for react specifically, though there are plenty solutions for uploading via web, including Amazon's own client.
This could be extended for the web fairly easily, but I don't have plans to do so at the moment.
from react-native-aws3.
@benjreinhart if you give me some information about what needs to be extended in the library I will gladly submit a PR as using one lib for both web and native clients would be great. Also great job on this library!
from react-native-aws3.
@kennetpostigo I might be missing some things but here is my initial high-level thoughts. For web, I think it'd be pretty easy since we should not be generating signed urls on the client because that would require us to have the IAM user's secret key on the client. So I believe we may need the following features:
- Support for passing in a pre-signed URL. As @joonhocho pointed out in #3, it is not a good idea to be passing secret keys to clients. This is especially true on web where it is trivial to inspect source and find any information like secret keys if they were passed down to the client either in the JS or HTML. However, this would have to be optional because, for now at least, I'd still like to be able to generate the signed urls on the client in React Native. I may change my mind on this going forward.
- Would need to consider how far back you want to go with browser support. I'd be inclined to say ignore this, especially for now. Also, the code, as it exists, would probably be mostly compatible with most versions of major browsers but I'm not sure what methods I'm using that may not be available in all versions of all browsers.
- In addition to the point above, we'd need some build step and have a compiled version of the JS since browsers most definitely do not have full on ES6 support.
I'm guessing I'm missing something but that's what comes to mind.
from react-native-aws3.
@kennetpostigo, I am currently using the following repos on my project.
https://github.com/joonhocho/s3-policy-middleware
https://github.com/joonhocho/s3-policy-v4
I created these repos to generate s3 policy on the server side on Node.js.
s3-policy-v4
is a simply refactored clone of react-native-aws3/src/S3Policy.js
(thanks to @benjreinhart).
If you are using express, you can use s3-policy-middleware
, which is a simple middleware wrapper around s3-policy-v4
.
If you are using node.js, but not express, then you can use s3-policy-v4
and create an endpoint yourself.
On the client side, you need to post to the endpoint with name
and contentType
(if you are using s3-policy-middleware), and you will receive the policy back in json format.
Then, you need to use the signed url that you receive with the policy to upload to s3 directly on the client side.
I also have some code to upload to s3 using XMLHttpRequest
which is available both on react native and web, but I haven't open sourced it yet.
I will do it soon when I get some free time.
from react-native-aws3.
@benjreinhart Thanks for the information. I'll see if I can whip something up on my spare time.
from react-native-aws3.
Related Issues (20)
- Mulitple upload HOT 2
- I have only identityPoolId. So, what should I do? is this library support?
- File Upload Dont work in Android HOT 3
- A server with the specified hostname could not be found. HOT 2
- How use Amazon S3 Transfer Acceleration
- postResponse null issue HOT 1
- How to upload multiple files? `Solution`
- Write error: ssl=0x752c77f708: I/O error during system call, Broken pipe
- {"headers": {}, "status": 0, "text": "Stream Closed"} HOT 13
- How to access(get uploaded file) the private bucket in aws s3 repo ?
- Unable to upload video when bucket name contains dots eg. domain names
- FormData and XMLHttpRequest are not defined
- Google play - Leaked AWS credentials HOT 1
- Failed to upload image to S3
- Abort upload HOT 2
- Stream Closed HOT 10
- Error :- read failed: EBADF (Bad file descriptor) when upload image. HOT 2
- Check s3 folder size through RNS3
- Is this going to be affected by AWS’s Move to Its Own Certificate Authority?
- In Android its not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-aws3.