Handle signed upload from react-native
I am new to using this service and I have spent the last 3 days trying to understand how to implement the image uploading with a signature. The documentation does not specify that this is not possible, but neither does it show examples of concerts such as managing the complete flow. So I ask if it is possible to upload an image directly from my app using a signature provided by the server (in the style of s3), and so an example. What I tried to rate was completely unsuccessful. In fact, by making simple HTTP requests and including the "upload_preset" field in these, I get an error regarding the absence of the API key. However, from what I understand, and from what common sense tells me, this key should not be used in the client because that would mean making it public. I ask so how can I proceed because I'm stuck.
-
Hi Niccolo,
Thanks for the feedback regarding the missing examples. This was raised before and we already have an open request for our docs team to add more examples. I'll re-emphasize internally the importance of such docs.
Below you can find an example of signed upload using js (chunked) -
https://jsfiddle.net/roee_ba/qptrcg1m/
You can also refer to this thread, which also has the server-side covered (note that the code was generated by one of our users and not by us).
Another option would be to use the Upload Widget for signed uploads. Here's an example - https://jsfiddle.net/roee_ba/21mu6ndr/
Note that the 'API_Key', unlike the 'API_Secret' which is used for our backend API methods, can be safely shared on the client-side.1
Post is closed for comments.
Comments
1 comment