Skip to Content
Phoenix Web Development
book

Phoenix Web Development

by Brandon Richey
April 2018
Beginner to intermediate content levelBeginner to intermediate
406 pages
9h 33m
English
Packt Publishing
Content preview from Phoenix Web Development

Working with uploads in Phoenix

Phoenix doesn't have anything built into its directory structure to store uploaded files, so that's something we'll have to write ourselves. We'll start off by creating a new directory in the root of our application called uploads in the root directory of our Phoenix application. We'll also want to make sure that the directory is included if we're using something like Git for source control:

$ mkdir uploads$ touch uploads/.gitkeep

We'll also have to modify our endpoint to allow serving files from this new directory. To do this, you tell Phoenix that, as part of the plugs responsible for keeping the server alive and moving, you'll also include a line for Plug.Static telling it that there is a new directory for ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Phoenix in Action

Phoenix in Action

Geoffrey Lessel
Real-Time Phoenix

Real-Time Phoenix

Stephen Bussey

Publisher Resources

ISBN: 9781787284197Supplemental Content