Handling broken file upload

Hi

I’m developing the ruby server-side of a Java Applet that does file
uploads. The applet client supports resume uploads (sending a HEAD first
to check for file size). The problem is I don’t know how to handle a
broken upload in the server side.

As far as I know, a regular file upload sends a POST with multipart
data, so the server can handle the upload, but the POST is sent when the
entire file has been uploaded to the server.

So I need to do some CGI trap or something to detect when a file is
being uploaded (before sending the POST to the controller) and do
something with it when it doesn’t complete the upload.

Any clues on when to look?

Thanks