Docs ModUploadProgress » History » Revision 12
Revision 11 (Mave99, 2008-12-21 23:47) → Revision 12/22 (stbuehler, 2009-02-17 09:29)
h1. Module [[TracNav(DocsToc)]] <pre> #!rst ======================================= Uploadprogress with Lighttpd 1.5.x(svn) ======================================= -------------------------- Module: mod_uploadprogress (1.5.x) -------------------------- {{>toc}} .. meta:: :keywords: lighttpd, upload, progress h2. .. contents:: Table of Contents Options ======= h3. :: upload-progress.progress-url string, empty = <string> (empty by default; default, use "/progress" (or something else) to enable the module h3. module) upload-progress.remove-timeout integer, default: = <short> (default: 60 seconds h3. seconds) upload-progress.debug boolean, default: "disable" h2. Config Example <pre> upload-progress.progress-url = "/progress" upload-progress.remove-timeout = 30 upload-progress.debug = "enable" </pre> "(enable|disable)" (default: "disable") h2. Warning This module will not work if you are using more than one worker ("server.max-worker":Server.max-workerDetails) h2. Description =========== This module can be used to track the progress of a current upload. When a file upload is done, the current received bytes are tracked with this module and can be retrieved via the progress-url and the tracking key. This key has to be added to the upload url or via header. In combination with server.max-request-size, usually the browser will display an error page containing information that the connection has been terminated. This can not be replaced with a custom error page, the browsers aren't displaying them. The uploadprogress module tracks this errors now. If the upload is done in one window (or an iframe which will be hidden on form submit), another iframe can display a custom uploadprogress page which can also fetch the status 413 via json if this happen. If 413 is retrieved, a custom error message (File is too big) can be displayed. The first examples can be found at http://blog.lighttpd.net/articles/2006/08/01/mod_uploadprogress-is-back The mentioned multi-frame example will be added in the future. h2. How to use it Generate a progress-id (32 hex digits - just use a md5 hash); send this progress-id in the upload request and in all progress requests, either as "X-Progress-ID" header or as "X-Progress-ID" query string parameter. h2. JSON Response ==== The returned json may contain: * state state: current state of upload values = starting, error, done, uploading * status status: http error status values = 413 * size: size size of request * received received: bytes received by lighttpd yet h2. Example 1 ======= Three html-files are appended as example, based on Jan's work mentioned at the link above. You need to add the tracking_id (an example how this is done with a single page upload and javascript is also provided at Jan's blog). In the iframe version, you can generate the tracking_id via php or other server-side scripting. Warning, the files are not working out of the box, you have to change things! Downloads: Downloads * ========= index.html - main page http://trac.lighttpd.net/trac/attachment/wiki/Docs/ModUploadProgress/index.html * status.html - page containing progress http://trac.lighttpd.net/trac/attachment/wiki/Docs/ModUploadProgress/status.html * upload.html - page posting the file http://trac.lighttpd.net/trac/attachment/wiki/Docs/ModUploadProgress/upload.html </pre> h2. Example 2 Note Since lighttpd v1.5 r1896 there has been a slight change in the upload url (see http://trac.lighttpd.net/trac/ticket/1300), the url format of the page to POST upload to changed from this format: Theres http://example.com/upload.php?<32_character_unique_id_goes_here> to this format http://example.com/upload.php?X-Progress-ID=<32_character_unique_id_goes_here> notice the X-Progress-ID=<32_character_unique_id_goes_here> key => value pair theres a new example (using YUI framework) here: here http://redmine.lighttpd.net/attachments/399/index.2.html http://trac.lighttpd.net/trac/attachment/ticket/1300/index.2.html beware of max-worker, uploadprogress will not work when using more than one worker. You get more informations here http://redmine.lighttpd.net/wiki/lighttpd/Docs:MultiProcessor. hope this helps people