jaimeiniesta

jaimeiniesta

How to upload server-generated content to S3 using waffle?

I need to store screenshots, these will go in a postgres table and I was thinking of using waffle-ecto to attach them, and using image transformations to get different versions of the image.

However, I can only find examples on how to do that if the image comes from a multipart form submitted by a user, but in my case I have the contents of the screenshot as a binary as it’s fetched from an external service in the server. What is the proper way of attaching that using waffle?

The same could apply to other server-generated content like charts, csv, pdf… How to attach that using waffle-ecto?

Marked As Solved

kokolegorille

kokolegorille

You can make a fake Plug.Upload from the path and use it for Waffle Ecto…

Also Liked

kokolegorille

kokolegorille

You might need to clean up temp file after save… that is what I do with Live Uploads and Waffle Ecto.

Last Post!

kokolegorille

kokolegorille

You might need to clean up temp file after save… that is what I do with Live Uploads and Waffle Ecto.

Where Next?

Popular in Questions Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54921 245
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42533 114
New

We're in Beta

About us Mission Statement