How to check file size before file upload completes?

Is it possible to check a file's size before a file upload completes? We want to limit file uploads early by checking the header's content length from the request object. The controller action and before_filter doesn't seem to run until the file finishes uploading.

Use a Flash uploader, it will even do clientside filesize validation. SWFupload.org is one of them. They do have some gotchas with Rails cookie store and sessions, but you can find more information on that by searching the list archives.

Best regards

Peter De Berdt