You should define a max value in a variable (or constant, whatever your preference is) inside your script, that way you don't rely on what the user sends you.
Then, simply check if the file uploaded failed due to errors (see: [man]features.file-upload.errors[/man]) OR if the file uploaded is still greater than your defined max size. If so, display an error message; if not, continue processing the file upload.
Beyond general advice like the above, you'll have to show us your code if you can't figure it out.