PHP alone will never do that. You'd have to be able to know the size of the file before it is completely uploaded, which is impossible because PHP is server-side and has absolutely no idea of what is going on on the cient's side.
To give you an idea, if you want to restrict uploads to certain types of files, your server has to accept whatever file is sent, check the file type and then, if it's not acceptable, discard it.
Maybe it's possible to check the size of the file using Javascript, but I have no idea if even Javascript can do that. And if it does, passing that information from the client to the server would be quite a remarkable stunt. I've been trying to pass on screen resolution to PHP through links in a long time, but still haven't found out how to do that because I don't know Javascript syntax to build the links.
Good luck, you're gonna need it.
Luciano ES
Santos, SP - Brasil