Drazen
Drazen

Reputation: 2826

Rails ActiveStorage how to Fileupload via REST API

How can I upload a file from an external service or app (iOS App, Go App, etc) to a Rails REST API which uses Active Storage local file storage?

All the tutorials I can find use HTML forms. I'd like to upload my files via a POST request to the Rails API. The main thing I am uncertain about is what headers and what kind of format I need to send the files in to the backend.

Upvotes: 7

Views: 1902

Answers (2)

Drazen
Drazen

Reputation: 2826

The solution was to just send normal form-data. I used Postman for testing which works great for file uploads as well http://getpostman.com

Upvotes: 1

Kaushlendra Tomar
Kaushlendra Tomar

Reputation: 1440

Base64 is useful for you, You can decode base64 then generate temp file and upload that file.

Upvotes: 0

Related Questions