How do I send an image or file to an API
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)