You can also check out
http://www.servlets.com/cos/faq.html Search on this page for the first instance of the
word "configure".
The question being answered there is different than yours, but it contains good information on using the COS package to do what you want. (Modify where it says "If you want to have a maximum file size..." to "If you want to know the size of only the files in the POST...")