Limit upload file size

How do I limit upload file size. When I attach a file I know size. But I don't know how to limit.

New a method on relationship before add?