[tbnl-devel] Add hook before uploading a file.

Erik Enge erik.enge at gmail.com
Sun Sep 17 18:45:02 UTC 2006


My users will upload files as large as 500M to my servers.  This will
of course take awhile and I think it's asking for trouble to let them
submit and then just let the browser sit there and spin a
currently-working-cursor without any other feedback.  So, I use an
IFRAME and some Ajax to submit the form and also poll to see how the
submittion is coming along.  Then I report this to user in the form of
a progress-bar.

(Lots of examples of this, just search for "ajax upload progress" in Google.)

Anyway, by default in TBNL, as far as I can tell, the request doesn't
hit my code until after the file has been uploaded.  What I think I
really need instead is to have access to the temporary filename
created for the upload (so I can track its size) right before TBNL
starts reading the file.

I've put this together locally by creating a hook in
MAKE-TMP-FILE-NAME[1] which is simply called with the tmp-file-name
created before returning.  In my code I then use this filename to
create data for the progress-bar.

My question is whether there's a better way to achieve this and/or
whether or not you want a patch.

Thanks,
Erik.

[1] I think a comment explaining that it's called from the RFC2388
code would've been really helpful.  :-)



More information about the Tbnl-devel mailing list