Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Activestorage (direct uploads) via API

I'd like to use Rails as a backend to a mobile app (Android and maybe iOS), and one of the requirements is file upload.

I haven't been able to find any resources on using Activestorage with direct upload in this way – does anyone have an example or tips?

The alternative – I suppose – is to reverse-engineer activestorage.js and do exactly what it does. But perhaps I'm not the first one with this need...

like image 703
elsurudo Avatar asked Apr 06 '18 09:04

elsurudo


1 Answers

Rails does not care if your data is sent from a mobile-app, html-form, react-app, server-to-server...

If you can authenticate the request and send a multi-part file, then you do active-storage from your app.

Probably smart to look at gems/apps that do this already https://github.com/cbothner/react-activestorage-provider

like image 73
Blair Anderson Avatar answered Oct 15 '22 17:10

Blair Anderson