[racket] Upload progress bar project
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.
http://www.openjs.com/articles/ajax/ajax_file_upload/
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.
HTH,
N.