Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do I send an image or file to an API

codecabinaustralia asked in General

What's best practice to send an image or pdf to an API endpoint?

Scenario:
I have a vuejs app I want to send an image or PDF to a Rails api application. The I want to use active storage to organise the file in S3.

  • Should I just post straight to S3 and somehow get rails to save to active storage?
  • Or should I convert to BASE64 then send in body (seems a lil hacky)
  • Create a POST request to the API server which accepts CORS rule (I always have trouble doing stuff like this for some reason)
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,464+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.