I am using Ruby on Rails 3 and in a my view file I have this code:

```
<%= form_for (@account, ...) do |f| %>
  <%= f.file_field :file %>
  ...
  <%= f.submit "Upload" %>
<% end %>

```

In order to avoid an overloading of the server, I would check the size of the uploading file before that the server receives it. This is because, pressing the submit button of the form, the server first will entirely receive the file and after will check the file.

I know that a [HTTP request has header fields](http://en.wikipedia.org/wiki/List_of_HTTP_header_fields), so I would like to check those for the uploading file, in particular, in my case, the *Content-Length* value.

**How to do that?**