Giter VIP home page Giter VIP logo

Comments (3)

seanadkinson avatar seanadkinson commented on July 17, 2024

When the user requests a signed URL, your backend is providing the path to PUT the file to S3, so you should know how to build the public image URL from an image name, no? So when you save the image to the backend, it can rebuild the public URL from the image name.

The bundled s3router.js file provides an endpoint for you to provide the image name, and it will redirect to the public URL. You could do the same in your RoR code.

So what our application does is:

  • Client provides image name, and asks for a location to PUT in S3
  • Server prefixes the path to S3, signs the URL, and returns the data
  • Client PUTs to S3
  • Client sends image name to server for storage
  • When request image, client provides image name to /s3/img/{imageName}
  • Server prefixes imageName with path to S3, and sends a redirect (or simply proxies the image in some cases)

Does that make sense?

from react-s3-uploader.

seanadkinson avatar seanadkinson commented on July 17, 2024

Re-reading your question, I think I realize now that you are saying that you simply are POST-ing the form, using a normal browser form submission. Is that correct?

If so, and as you probably noticed, I don't think this library is providing any useful <input> information for the backend in this case.

There is enough callbacks though, that probably what you should do is just create an <input type="hidden"/> with the necessary information using javascript, after the image has successfully loaded.

Let me know if that is helpful, of if I am just missing the point.

from react-s3-uploader.

jakubrohleder avatar jakubrohleder commented on July 17, 2024

@seanadkinson Thanks for the answer. Actually in you answered my question in the first part :). This flow sound really reasonable. I've haven't notice an obvious fact that the file public url can be easily recreated from bucket name, region and file path.

Thanks a lot ๐Ÿ‘

from react-s3-uploader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.