Can't access data on Volume for some reason (Phoenix App)

I have an Elixir app which allows users to upload images. I created a volume and when user uploads an image, that image is successfully saved but for some reason I can’t access it from my app.




config :brownie, UploadsDirectory,
    uploads_directory: "/data"

My app creates an image with the following path (random character string you see is a users folder name which is created when user creates an account).

<img src="/data/1LBOTl/avatar.svg">

But for some reason that image is not loading. I’m getting 404 error for it. I’ve checked the folder structure with fly ssh console and the folder and the file both exists at the path /data/1LBOTl/avatar.svg.

Can anyone help with that?

You will need to add a second Plug.Static in your endpoint that points to the /data dir.

  plug Plug.Static,
    at: "/data",
    from: "/data",
    gzip: false

This will make those files available for a browser to show them.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.