Browser survey: unlimited sized uploads
This post surveys the current state of HTTP browser file uploads and motivates the need for a Java applet to upload files.
Survey of Large Browser Uploads
Modern requirements for uploading files in a browser are few and simple:
- File size should not be limited by the uploading mechanism.
- There should be some progress feedback to the user.
- Large uploads should be resumeable.
- It should be possible to upload multiple files.
- Uploaded files should be integrity checked.
In fullfilling these requirements natively currently all browsers fall short. This is due to two things: 1) The nature of HTML(4|5); and 2) suboptimal browser implementations.
HTML4: Uploads
HTML4 file uploads was introduced over 15 years ago in rfc1867 and is still the de facto standard of uploading files. The following shows the HTML code to upload a file:
<form method="POST" action="/" enctype="multipart/form-data">
<input type="file" name="file" />
<input type="submit" value="Upload" />
</form>
Obviously, it's not possible for the user to select multiple files. The number of files the form can upload is equal to the number of HTML inputs of type file. In addition, there is nothing in the standard when it comes to integrity checking or resuming uploads. When it comes to the size of files no limit is stated. Browsers, however, most likely fall short in uploading large files. Underneath, Table 1 shows which of the requirements are satisfied nativly by browsers.
| Feature \ Browser | Chrome | Firefox 3.6 | Opera 11 |
|---|---|---|---|
| Streamed | Just before the upload finishes everything is loaded into memory! |
File is loaded into memory! |
|
| +2GB | When file is above 2GB the upload stops after ~100MB! |
||
| Progress feedback | |||
| Resumeable | |||
| Multiple Files |
Other tools available for the job - and why they all fall short!
- HTML5: From the outset HTML5 looks promising. HTML5 includes
the File API. The File API makes it possible to read a file from the
user filesystem and process it at the client. Looking into the File
API, however, shows that there is no support for streaming
files. Everything is loaded into memory!
For more see the FileReader spec - Java: Advanced Java applets are a pain both to develop and from a user perspective. Applets take forever to start-up, the user needs to confirm the signature of the applets that read from the filesystem, the GUI is OS inconsistent, and the plugin is not ubiquitously available. In addition, in order to work with HTTP uploads at a sensible abstraction level, you need some external library (e.g. Apache httpcomponents) increasing the size of the applet. Advanced, JavaScript to Java interaction is also difficult and buggy, see applets-missing-information-about-liveconnect-and-deployment)
- Flash: Flash outshines Java in three ways: 1) it has the highest
world-wide penetration rate; 2) faster startup time than Java; and
3) needs no signing. However, Flash suffers mayorwise when it
comes to uploading large files. In Flash file access is facilitated
by FileReference. For
some reason the size of files is stored internally as signed ints
causing integer overflow when working with +2GB files!
- Silverlight: I'm omitting Silverlight because of the low penetration rate of 58 %.
Features of the available tools are summarized in Table 2.
| Test \ Browser Technology | Flash | Java | HTML5 + JS | Silverlight |
|---|---|---|---|---|
| +2GB | N/A | |||
| Stream upload | N/A | |||
| Upload progress | N/A | |||
| Resume upload | N/A | |||
| Penetration Rate (US April 2011)* | 88% |
77% |
N/A |
58% |
Note: the general riastats page is biased; half of the visitors are from Hungary, and therefore useless for a general penetration rate overview!
The only widespread tool where it's not plain impossible to upload +2GB files is Java! That fact led me to implement an open source Java applet uploading runtime for plupload. It's available at github, and a demo is running at jdams.org.


