Just a shout-out to LiveView uploads

I’ve been working on a Phoenix app in my spare time since summer and it is slowly getting there (pushing 12k LOC and over 1100 commits). There were a few places where the user can upload files, some of which get processed further (e.g. into slippy maps), meaning a mix of local storage during some processing and cloud storage in an S3 system.

I used a JS library for the drop area, had to swim upstream to get Plug’s multipart uploader to correctly change the maximum upload size based on the user, and still never got it quite butter-smooth. It worked, but not in a way I’d consider fantastic, and for some of the users on not-so-great Internet connections they would struggle with the HTTP uploads when sending larger file (30MB+, not exactly massive…) …

Over the weekend I ripped all of that out and replaced it with the shiny new LiveView uploads, after having watched them with interest and kicked their tires a bit first. The code count is about the same, but I was able to drop yet another JS library from the bundle (less to send over the wire, less integration between the JS lib and LiveView processes, … all good things) and it was sooooo simple to theme and get working exactly as I wanted, even with multiple upload areas with different purposes in the same LiveView. A fraction of the effort the JS-library-plus-HTTP-uploads were to stitch together into a nice experience, with better results.

The big highlight was that for a good number of the people using the application over those semi-dodgy connections … it is waaaaaay faster and more reliable for them. It’s no surprise that a connection-oriented mechanism was likely going to be better for this sort of thing than a stateless message-oriented protocol, but I was pleasantly surprised by how much better the LiveView implementation was. They obviously do not care about my code count or the maintainability of the codebase or the technical beauty (or lack thereof) of the internal design: what I write is a tool, and for them it is the results that matter. They noticed when I deployed the version using LiveView upload to production, and that is awesome.

So this is just a little love letter to everyone who worked on LiveView and particularly uploads. Thank-you so very much for all you’ve done in making Phoenix so very good, and ditto for those working on all the tech it rests upon. You rock.


This is an amazing shout out and what I needed to hear today :slight_smile:
Cheers :heart::heart::heart:


Valuable insight as I’ll be adding LiveView uploads to a project soon. @chrismccord gives a great overview here Phoenix LiveView Uploads Deep Dive

1 Like