HTTP File Uploads


Originally posted in my old blog at My Opera

Here's a chance for Opera to shine again:

Make a better interface for file uploading.

Jeff Atwood's post “Why Are Web Uploads So Painful” reminded me of this – Uploading files with a browser is incredibly annoying. Firefox is the only browser that even displays a progress bar natively, I haven't seen either Internet Explorer or Opera display that, although Opera apparently should display one. You just wait, wait, wait and hope that the upload isn't stalled and will finish sometime soon…ish.

This is a very big thing now that video sites like YouTube are popular. I'm lucky to live in Finland where you can get a 10/10mbit connection (that's about 1000KB/s upload and download) for a reasonable price, uploading on a connection like that isn't bad at all. Most of people aren't as lucky as I am though, many people are still on connections with less than a megabit of upload bandwidth. Not to mention Australia, where fast DSL connections are really expensive and it's almost impossible to find one without a monthly traffic limit.

I don't think it's impossible to give users a nice interface for uploads. If you consider the way the HTTP protocol works, you could give the user a very similar interface for monitoring the progress of the upload as you get for downloads – Maybe even an option for being able to close the uploading page. The browser could take control of the request, separate it from the page, letting the user do something else with the tab/window without the upload stopping. The upload could continue on the background and when it's complete, the browser could perhaps just open the page which would normally open after the file upload was complete. Something like this would not even require any changes in the website's code, since it's just a client-side change: The browser just displays a progress bar for the upload and perhaps the speed and how long the upload will take.

Having an ability to continue the upload if it stops would be very nice to have, but in addition to changes in the protocol, this would require changes in the websites which accept file uploads too.

At the moment, it is possible to monitor upload progress with some JavaScript or Flash components. YouTube has an uploader which uses Flash, for example. However, it isn't as accurate as having it built-in in the browser would be.

There is also the FancyUpload script, which is based on MooTools and some Flash. Looking at the demo, this is definitely one of, if not the best, implementation for file uploads. It does it all: Multi-file uploads and a progress bar. There's just the Flash component which some people obviously will not like, but really, would you rather not see a good progress bar than install/use Flash?

Also, what happened to HTTP PUT? Wasn't the PUT method supposed to be used for file uploads? As far as I know, only W3C's Amaya supports sending files with the PUT method. Also, PUT is idempotent, which means that you can redo the action more than once without causing problems. If you send a form twice with POST, you may end up having done the action you wanted twice. There are some issues with it, though, like the fact that the request is supposed to be sent to the address where the file will end up on the server.

So here's a chance for Opera to show how it's done (again): Give us a proper file upload UI. There isn't even a Firefox plugin which does that yet (as far as I know)!