This software example design is based upon the web server application that ships with the Nios II EDS. It reduces memory footprint, improves upload performance, and implements an AJAX (Asynchronous Javascript and XML) based progress bar. Well...it's not really AJAX-based. It's actually implemented using JSON (Javascript Object Notation) rather than XML because it's both easier to understand/parse and supported natively in Javascript.
As the upload is happening, the Javascript code (progress.js) sends GET requests to /PROGRESS on the server. The server returns a JSON "object" that looks like the following sample:
new Object ({ 'state' : 'uploading', 'percent' : '56', 'speed' : '58' })
where "speed" is in kilobytes per second. The webserver had to be enhanced to support GET requests for "dynamic" URLs. For now, this is only the "/PROGRESS" URL, but it could easily be extended to support much more.
All-in-all, I can easily state that this is much better (and simpler) than using some other server-side scripting to implement that same thing.
The attached ZIP file contains html_content and webserver_with_progressbar sub-directories. The HTML content is intended for an ro_zipfs (Read Only ZIP filing system), but can be used elsewhere. The software is intended for use in the Software Build Tools Flow and, as such, has a create-this-app script.
Things are reasonably well-commented, though you're welcome to contact me with any further questions that you have. The code could use a bit of cleaning up, but it's not likely that I'll have the time to get to that...at least in the short run.
| File | Size | Date | Attached by | |||
|---|---|---|---|---|---|---|
| WebServer_with_AJAX_progressbar.zip Includes the following directories: html_content (HTML content), webserver_with_progressbar (Software Build Tools project that implements the server side) | 97.86 kB | 00:14, 7 Jul 2009 | brendan | Actions | ||