When using Tomahawk’s file upload component it isn’t obvious how to catch what happens when you blow the file size limit. The file limit is set in the web.xml configuration for Tomahawk, i.e.
1 2 3 4 5 6 7 8 9 10 11 12 13
Here you can see the limit is set to 10 meg.
So by default, if you blow the limit, the component fails silently.. or does it?
Well, the component actually adds a couple of attributes to the request when refreshing the page (following the click of the upload button). The attributes are:
by checking the request (during the page render) you can grab these attributes, if set, and display something meaningful to the user. You could have a little render tag at the top of the page to ensure the attributes are checked. Whilst this is a bit cronky, it is one of the jsf workarounds which does work.. in a fashion.
If they are present and you want to display the max size to the user, then apache commons FileUtils comes along to save the day