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
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
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
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…
Popular in Questions
Other popular topics
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









