[tbnl-devel] uploading a huge file / ajax progress bar

Mac Chan emailmac at gmail.com
Tue Feb 14 00:15:33 UTC 2006


On 2/9/06, Edi Weitz <edi at agharta.de> wrote:
> This should not happen.  Maybe you're using older versions of TBNL
> here?  The code which is responsible for the streaming was
> inadvertently left out from some released versions.

I forget what version of tbnl I was testing with, but it was the
latest one when I tried it. I'll report back when I have time to do
this test again.

> What you describe seems to be the usual way to do it.  I also did
> something similar once for a mod_perl application.
>
> As far as changing RFC2388 is concerned, it would be nice if we could
> convince Janis to add the changes to his distributions (and therefore
> make them unobtrusive so they won't bother non-TBNL users).

I spent sometime reading the perl code by Raditha Dissanayake
(http://www.raditha.com/php/progress.php) and implementede the same
idea in tbnl.

Basically, before the user submits a file, we need to create a unique
identifier (at least unique for each user) and associate this id with
the form post request.

We then pass this id to a popup page so it can poll the uploading progress.

Since the file upload will be part of a multipart/form-data stream,
it's easier to pass the id in the query string and rearrange the
initialization order of the get-parameters and post-parameters. This
way by the time we are saving the file  (post-parameters) we'll have
the id ready (get-parameters).

There might be a cleaner way to do this but I don't know better.
Please take a look and feel free to change it or make it sucks less
(I'm not trying to create more work for Edi or anyone though).

TBNL is really a lot more fun than other web frameworks I've used.

Cheers,
-- Mac
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rfc2388.patch
Type: application/octet-stream
Size: 9423 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20060213/7d4ce3ed/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file_upload.patch
Type: application/octet-stream
Size: 16453 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20060213/7d4ce3ed/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: packages.lisp
Type: application/octet-stream
Size: 6819 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20060213/7d4ce3ed/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: specials.lisp
Type: application/octet-stream
Size: 13242 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20060213/7d4ce3ed/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: request.lisp
Type: application/octet-stream
Size: 21701 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20060213/7d4ce3ed/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.lisp
Type: application/octet-stream
Size: 26958 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20060213/7d4ce3ed/attachment-0005.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rfc2388.lisp
Type: application/octet-stream
Size: 20051 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20060213/7d4ce3ed/attachment-0006.obj>


More information about the Tbnl-devel mailing list