lighty's life

lighty developer blog

Mod_uploadprogress Is Back

In my ongoing efforts in restructuring the core of lighttpd for the 1.5.0 release I brought mod_uploadprogress back to life. I talked about mod_uploadprogress a long time ago and since then I got at least one request per month to bring it back again. It was changed abit since the early days. Instead of XML we send out JSON now. That does the same and easier to parse:
{ 'state' : 'starting' };
...
{ 'state' : 'uploading', 'size' : 87901150, 'received' : 80601372};
{ 'state' : 'done', 'size' : 87901150, 'received' : 87901150};
First you need a file-upload form. It is all standard and only calls our upload-progress updater onSubmit.
  
The progress bar in this case are 2 nested div-tags:
  
 
(throughput)
Some Javascript with XMLHTTPRequest can tell us about the state of a upload:

Now I only have to commit this code to SVN and make a pre-release :)

Please note that we won't accept comments for posts older than 3 months! Also please use our bug tracker to report bugs, and our irc channel #lighttpd@libera to chat.

« 1.4.12 becomes 1.5.0 Expect: header handling is in »