I’m working on a project that requires a Web page that allows users to upload data to a server. I figured that this would be drop-dead easy. I was wrong. Really wrong.
First, let me say that I mostly write algorithms rather than applications. So, my first step was to search the Internet to determine what the recommended way to do a Web file upload was.
I found absolute chaos. There are dozens of libraries you can buy, libraries on GitHub, and private libraries. And scads of personal blog sites that give code examples.
After a few days of research, I found that there is very contradictory information about HTML file upload. My first thought was to use a GitHub library. Candidates included Dropzone JS, jQuery File Upload, Plupload.
However, after a lot of investigation I decided that taking a dependency on a library would be a bad idea, mostly because the requirements for my project aren’t stable and I wanted full control.
So next I researched writing file upload from scratch. I found a lot of flat-out incorrect information. But after a few day of experimentation, I felt I had finally figured out exactly how to do file upload.
There are many design decisions. Do you use the HTML5 File Control, or use drag-and-drop (or both)? Do you upload files automatically, or cache them up for the user to review before uploading? And many more.
Anyway, it was a fun and interesting learning path.