0

Phoenix/Elixir learner here :)

I tried to access an image file under sub directory (ie:dashboard) of a Phoenix application, something like :

http://localhost:8000/dashboard/media/tv1_1.jpg

but it keeps throwing me with the same error messages

Phoenix.Router.NoRouteError at GET /dashboard/media/tv1_1.jpg
no route found for GET /dashboard/media/tv1_1.jpg

Here is a snippet of my configuration setting in endpoint.ex

  plug Plug.Static,
    at: "/dashboard",
    from: :my_dashboard,
    gzip: false,
    only: ~w(css fonts images js favicon.ico robots.txt)

  plug Plug.Static, at: "/media",
  from: "user_media",
  only: ~w(*.mp4 *.jpg *.jpeg *.png)

Also, I put upload folder (user_media) on the same level of Phoenix application's root directory.

Hope someone could pinpoint of what I've missed here.

Thanks in advance.
-dewa-

dewa19
  • 1
  • 2
  • Hi @dewa19, can you share your file system structure? Specifically it would be good to see where this media folder is in relation to the project. – Elliot Blackburn Jan 04 '22 at 14:30
  • Hi @ElliotBlackburn, thank you for your interest. This is my project full path : `/home/dewa19/Elixir/real-project/dashboard/my_dashboard` and the media folder located inside this project folder, ie : `/home/dewa19/Elixir/real-project/dashboard/my_dashboard/user_media`. I hope, this is what you meant by "file system structure"... – dewa19 Jan 05 '22 at 00:14

0 Answers0