Phoenix file directory for downloads

I would like to add a upload/download folder that can be used by signed in users (I implemented it with guardian) but files are not associated with any of them; file dump.

I would like to limit the type of files to for example .txt or .json if possible

Good to know!

Do you have a question? Right now you’re just telling the world about your goals. What have you tried so far? Where did you get stuck?

3 Likes

https://hexdocs.pm/phoenix/Phoenix.Controller.html#send_download/3

I was thinking of using this function, but it offers no way to list said files; upload and download only.

Phoenix is a web framework, not a webserver such as NGINX or Apache.

If you want to show your user something you have to write it.

You can use File.ls/1 to list the contents of a folder,
then you can show that list and have the user pick one,
next you can use send_download/3 to send them the file.

2 Likes