Topic: Enforce maximum file size for uploads

I have a Rails 3.2 application that accepts CSV files for importing data. I'd like to set the maximum file size for uploaded files. How can I do this? Unfortunately there doesn't seem to be a max_file_size for the Ruby CSV class.

Alternatively, I could set the max number of lines in the CSV file, but my first choice would be to set the max file size.

I'm trying to avoid the request size/response time limitations Heroku puts on the free accounts.


Re: Enforce maximum file size for uploads

I would like to do the file size check on the client side too. Anyone have a JavaScript or some other way to check file size on the client side?

By the way, I figured out how to use file.size to check in the controller. But I'd also like to check it on the client side.