New Discussion

Notifications

You’re not receiving notifications from this thread.

How do I send an image or file to an API

0
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)
Join the discussion
Create an account Log in

Learning Ruby on Rails? Join our newsletter.

We won't send you spam. Unsubscribe at any time.