odyright

odyright

Phoenix 1.3 ... how to configure Arc or Arc_ecto?

hello, how to use Arc && arc_ecto? I have an app that allows users to upload their avatar/picture and other files.
Or is it better for the moment to use the default plug.upload ? if yes, how to achieve this?

Most Liked

andy

andy

Figured it out. The Arc generator was putting the ImageUploader module in a folder called /web, which is defunct in Phoenix 1.3.

I moved this file to /lib/myapp_web/uploaders/image_uploader.ex and was able to get moving.

PatNowak

PatNowak

I guess Arc’s configuration shouldn’t be much different that in previous Phoenix versions- you have entry for arc in config.exs and for schema you are interested to use file upload, you use proper uses of Arc.Definition and Arc.Ecto.Definition.

I used in my own projects Arc and Arc_ecto, but in the company product we considered Arc to be to much erroneous - upload didn’t work so we decided to drop using Arc at all and it concluded that I wrote simple uploader on my own, which relies on ex_aws.

Basically - Arc creates it’s own file based on the input - it requires filename and binary, so it wraps a map or Plug.Upload to do the upload.

Maybe the function definition of ExAws.S3.put_object/4 is not self explanatory, but it wants you to pass:

  • name of the S3 bucket
  • file destination
  • file content - binary
  • additional options like ACL

With that knowledge you can intercept Plug Upload and use ex_aws directly without Arc.

I guess you can still keep uploaders in lib/myapp/web.

taorg

taorg

Hello
You got here a fully functional project, it’s a bit mess, because I used to test for real projects, but has both arc, arc_ecto S3 and a few other things…

Where Next?

Popular in Questions Top

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
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

Other popular topics Top

openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44139 214
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement