I need help/guide with how to add a field for image upload in my user profile model. I’m coming from my experience using django where in the ORM you can use ImageField for image upload.
Reading from the phoenix docs I understand one can use context generators to set up models. Will the image field be a string?
How do I achieve the same in phoenix?
Hello and welcome,
You can use Waffle and Waffle Ecto to do this.
It’s like CarrierWave in Ruby.
Most examples of Live File Upload use a string field. But it’s possible to hack a solution where LFU data is converted to Plug.Upload data, then managed by Waffle Ecto.
You can also use jsonb field if You want to store file metadata as well.
Oh thanks for the link to the library. I will have a look at it. I intend to map the profile model with one relationship with the user model