codecabinaustralia

Joined

100 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in 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)

Posted in Shrine Dynamic s3

Hi Chris,

I have a question I hope it's not out of scope for gorails but I'm having a hard time figuring it out.

I have a multi tenant site, each of the tenants add their own s3 credentials therefore any uploades that happen on their tenant site get's uploaded to their own s3 account.

The problem I have at the moment is that Shrine seems to only let me add s3 credentials in the initializer. I would like to add it to the model so that I can dynamically populate the s3 credentials depending on which tenant is being used at the time. Do you know anyway shrine can help me?

I managed to do this with paperclip but it came with other problems such as background processing etc.