Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def create(conn, %{"photo" => %{"image" => image_params} = photo_params}) do
album_id = photo_params["album_id"]
ExAws.S3.put_bucket("#{album_id}", "")
|> ExAws.request()
Enum.map(image_params, fn(img) ->
album = album_id
ext = Path.extname(img.filename)
u = Ecto.UUID.generate
flnm = "#{u}#{ext}"
{:ok, file_binary} = File.read(img.path)
s3_bucket = album
{:ok, _} =
ExAws.S3.put_object(s3_bucket, flnm, file_binary)
|> ExAws.request()
store(conn, flnm, album)
end)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.