[racket] Upload progress bar project

From: Noel Welsh (noelwelsh at gmail.com)
Date: Fri Sep 24 05:17:43 EDT 2010

Sorry I don't have time to go into code right now. It seems most
people will do this purely on the client side. See e.g.


for a sketch of how to do file upload without refreshing the page
using a hidden iframe.

 Thu, Sep 23, 2010 at 5:21 AM, Eduardo Bellani <ebellani at gmail.com> wrote:
> * A way to keep polling the server and update a field in the page with
>  the %. I am thinking about just saving the address to a function in
>  a hidden field. I would use that function to return the % based on
>  how much of the file is already written to disk.

If you really want to get a stream of information from the server you
are better of doing a "comet" request than continuously polling. On
the client side you call a URL using XMLHttpRequest. On the server
side you leave the connection open, and just pump data down it as it
becomes available. E.g. the server could send a stream of numbers
showing how many bytes have been uploaded. Use
make-response/incremental for this.

OTOH I don't think the web server allows you to intercept the request
parsing without going to quite a low level. In most setups the web
server will have already parsed the file into a bytes before your
servlet runs.

> * A way to know the full size of the file being uploaded.

Outside of checking the size of the uploaded form data I don't know of a way.


Posted on the users mailing list.