<p>Is there a way to validate on the client side browser whether the size of a file being uploaded from a JSP page is over a set size limit without forcing the user to upload the entire file only to find out it was too large?</p>

<p>I would like to stay away from any proprietary controls or techniques like Flash or ActiveX if possible.</p>

<p>Thanks!</p>

This isn't a perfect solution, but if you check the Content-Length HTTP header with
```
request.getHeader("Content-Length")
```
then you can choose to not transfer the entire file.
By way of explanation, an extremely large file will not be transferred all at once.  You'd have to actually open a stream representing that chunk of POST data and read from it for the entire thing to be transfered.
On the other hand, if you're worried about denial-of-service attacks, then you can't really trust the Content-Length header, because it can easily be forged.  In this case, you should set a limit and stream a transfer of this file, stopping as soon as you've exceeded that limit.